This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from a-barbieri/master
Update gems and version
- Loading branch information
Showing
20 changed files
with
339 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ spec/test_app/log/*.log | |
spec/test_app/tmp/ | ||
Gemfile.lock | ||
.byebug_history | ||
binda-api*.gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Binda | ||
module Api | ||
VERSION = '0.1.0' | ||
VERSION = '0.1.2' | ||
end | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FactoryBot.define do | ||
|
||
# IMPORTANT: | ||
# if you need to create a board use :board_structure | ||
# | ||
# Boards are automatically generated when you create | ||
# a structure with `instance_type` = `board` | ||
|
||
factory :board_structure_with_fields, parent: :board_structure do | ||
after(:create) do |board_structure, evaluator| | ||
# Fetch the deafult field group | ||
field_group = board_structure.field_groups.first | ||
|
||
# Generate some field settings | ||
create :string_setting, field_group: field_group | ||
create :repeater_setting_with_children_settings, field_group: field_group | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
factory :checkbox, class: Binda::Checkbox do | ||
association :field_setting, factory: :checkbox_setting | ||
end | ||
|
||
factory :component_and_checkbox, class: Binda::Component, parent: :component do | ||
after(:create) do |component| | ||
create(:checkbox, fieldable_id: component.id, fieldable_type: component.class.name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FactoryBot.define do | ||
|
||
factory :choice, class: Binda::Choice do | ||
sequence(:label){ |n| "Choice ##{n}" } | ||
sequence(:value){ |n| "Lorem ipsum #{n}" } | ||
association :field_setting, factory: :selection_setting | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FactoryBot.define do | ||
|
||
sequence(:article_title) { |n| "This is article number #{ n }" } | ||
|
||
# Component | ||
factory :component, class: Binda::Component do | ||
sequence(:name) { |n| "##{n} component" } | ||
slug { "#{name}".parameterize } | ||
association :structure | ||
end | ||
|
||
# Article Component | ||
factory :article_component, parent: :component do | ||
name { generate(:article_title) } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FactoryBot.define do | ||
|
||
sequence(:field_group_name) { |n| "Default details ##{n}" } | ||
|
||
factory :field_group, class: Binda::FieldGroup do | ||
name { generate :field_group_name } | ||
slug { "#{name}".parameterize } | ||
association :structure | ||
end | ||
|
||
factory :field_group_with_fields, parent: :field_group do | ||
after(:create) do |field_group| | ||
create :string_setting, field_group: field_group | ||
create :text_setting, field_group: field_group | ||
create :repeater_setting_with_children_settings, field_group: field_group | ||
create :radio_setting_with_choices, field_group: field_group | ||
create :selection_setting_with_choices, field_group: field_group | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
FactoryBot.define do | ||
|
||
sequence(:field_name){ |n| "##{n} Field Setting" } | ||
|
||
factory :field_setting, class: Binda::FieldSetting do | ||
name { generate :field_name } | ||
slug { "#{name}".parameterize } | ||
association :field_group | ||
end | ||
|
||
factory :repeater_setting, parent: :field_setting do | ||
field_type 'repeater' | ||
end | ||
|
||
factory :repeater_setting_with_children_settings, parent: :repeater_setting do | ||
after(:create) do |repeater| | ||
repeater.children.create( | ||
name: attributes_for(:field_setting)[:name], | ||
field_type: 'string', | ||
field_group: repeater.field_group | ||
) | ||
repeater.children.create( | ||
name: attributes_for(:field_setting)[:name], | ||
field_type: 'text', | ||
field_group: repeater.field_group | ||
) | ||
end | ||
end | ||
|
||
factory :string_setting, parent: :field_setting do | ||
field_type 'string' | ||
end | ||
|
||
factory :text_setting, parent: :field_setting do | ||
field_type 'text' | ||
end | ||
|
||
factory :radio_setting, parent: :field_setting do | ||
field_type 'radio' | ||
allow_null false | ||
end | ||
|
||
factory :radio_setting_with_choices, parent: :radio_setting do | ||
transient do | ||
_count 3 | ||
end | ||
after(:create) do |radio_setting, evaluator| | ||
create_list(:choice, evaluator._count, field_setting: radio_setting) | ||
end | ||
end | ||
|
||
factory :selection_setting, parent: :field_setting do | ||
field_type 'selection' | ||
allow_null true | ||
end | ||
|
||
factory :selection_setting_with_choices, parent: :selection_setting do | ||
transient do | ||
_count 3 | ||
end | ||
after(:create) do |selection_setting, evaluator| | ||
create_list(:choice, evaluator._count, field_setting: selection_setting) | ||
end | ||
end | ||
|
||
factory :checkbox_setting, parent: :field_setting do | ||
field_type 'checkbox' | ||
allow_null true | ||
end | ||
|
||
factory :checkbox_setting_with_choices, parent: :checkbox_setting do | ||
transient do | ||
_count 3 | ||
end | ||
after(:create) do |checkbox_setting, evaluator| | ||
create_list(:choice, evaluator._count, field_setting: checkbox_setting) | ||
end | ||
end | ||
|
||
|
||
factory :relation_setting, parent: :field_setting do | ||
field_type 'relation' | ||
end | ||
|
||
factory :image_setting, parent: :field_setting do | ||
field_type 'image' | ||
end | ||
|
||
factory :video_setting, parent: :field_setting do | ||
field_type 'video' | ||
end | ||
|
||
factory :audio_setting, parent: :field_setting do | ||
field_type 'audio' | ||
end | ||
|
||
factory :svg_setting, parent: :field_setting do | ||
field_type 'svg' | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
factory :image, class: Binda::Image do | ||
association :field_setting, factory: :image_setting | ||
end | ||
|
||
factory :component_and_image, class: Binda::Component, parent: :component do | ||
after(:create) do |component| | ||
create(:image, fieldable_id: component.id, fieldable_type: component.class.name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
factory :radio, class: Binda::Radio do | ||
association :field_setting, factory: :radio_setting | ||
end | ||
|
||
factory :component_and_radio, class: Binda::Component, parent: :component do | ||
after(:create) do |component| | ||
create(:radio, fieldable_id: component.id, fieldable_type: component.class.name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FactoryBot.define do | ||
|
||
sequence(:repeater_name){ |n| "##{n} Repeater" } | ||
|
||
# Article repeater | ||
factory :repeater, class: Binda::Repeater do | ||
association :field_setting, factory: :selection_setting | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
factory :selection, class: Binda::Selection do | ||
association :field_setting, factory: :selection_setting | ||
end | ||
|
||
factory :component_and_selection, class: Binda::Component, parent: :component do | ||
after(:create) do |component| | ||
create(:selection, fieldable_id: component.id, fieldable_type: component.class.name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FactoryBot.define do | ||
|
||
sequence(:article_structure_title) { |n| "N.#{n} Article" } | ||
sequence(:structure_name) { |n| "##{n} structure" } | ||
|
||
# Structure | ||
factory :structure, class: Binda::Structure do | ||
name { generate :structure_name } | ||
slug { "#{name}".parameterize } | ||
instance_type 'component' | ||
end | ||
|
||
# Boards are automatically generated when you create | ||
# a structure with `instance_type` = `board` | ||
factory :board_structure, class: Binda::Structure do | ||
sequence(:name) { |n| "##{n} board" } | ||
slug { "#{name}".parameterize } | ||
instance_type 'board' | ||
end | ||
|
||
# Article structure | ||
factory :article_structure, parent: :structure do | ||
name { generate :article_structure_title } | ||
end | ||
|
||
# Article structure with components | ||
# @see https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations | ||
factory :article_structure_with_components, parent: :structure do | ||
transient do | ||
components_count 3 | ||
end | ||
after(:create) do |structure, evaluator| | ||
create_list( :article_component, evaluator.components_count, structure: structure) | ||
end | ||
end | ||
|
||
# Article structure with components | ||
# @see https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations | ||
factory :article_structure_with_components_and_fields, parent: :structure do | ||
transient do | ||
components_count 3 | ||
end | ||
after(:create) do |structure, evaluator| | ||
# get default field group which is generated by default for each structure | ||
default_field_group = structure.field_groups.first | ||
# Generate some field settings | ||
create :string_setting, field_group: default_field_group | ||
create :text_setting, field_group: default_field_group | ||
create :repeater_setting_with_children_settings, field_group: default_field_group | ||
create :radio_setting_with_choices, field_group: default_field_group | ||
create :selection_setting_with_choices, field_group: default_field_group | ||
create :checkbox_setting_with_choices, field_group: default_field_group | ||
create_list( :article_component, evaluator.components_count, structure: structure) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
factory :svg, class: Binda::Svg do | ||
association :field_setting, factory: :svg_setting | ||
end | ||
|
||
factory :component_and_svg, class: Binda::Component, parent: :component do | ||
after(:create) do |component| | ||
create(:svg, fieldable_id: component.id, fieldable_type: component.class.name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
sequence(:text_name){ |n| "##{n} Lorem ipsum sit dolor" } | ||
|
||
factory :string, class: Binda::String do | ||
content { generate :text_name } | ||
end | ||
|
||
factory :text, class: Binda::Text do | ||
content { generate :text_name } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryBot.define do | ||
|
||
factory :user, class: Binda::User do | ||
|
||
email "[email protected]" | ||
|
||
pw = "abcDEF123$£@" | ||
password pw | ||
password_confirmation pw | ||
|
||
end | ||
|
||
end |