1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00

Update ModelGenerator to generate dynamic attributes

This commit is contained in:
Atul Bhosale 2018-08-25 02:18:00 +05:30 committed by Daniel Colson
parent 9f4323f415
commit 01a23ffbe1
3 changed files with 6 additions and 6 deletions

View file

@ -18,8 +18,8 @@ Feature:
""" """
FactoryBot.define do FactoryBot.define do
factory :user do factory :user do
name "MyString" name { "MyString" }
age 1 age { 1 }
end end
end end
@ -38,7 +38,7 @@ Feature:
""" """
FactoryBot.define do FactoryBot.define do
factory :user do factory :user do
name "MyString" name { "MyString" }
end end
end end
""" """

View file

@ -35,7 +35,7 @@ Feature: automatically load step definitions
""" """
FactoryBot.define do FactoryBot.define do
factory :user do factory :user do
name "Frank" name { "Frank" }
end end
end end
""" """
@ -73,7 +73,7 @@ Feature: automatically load step definitions
""" """
FactoryBot.define do FactoryBot.define do
factory :factory_from_some_railtie, class: 'User' do factory :factory_from_some_railtie, class: 'User' do
name 'Artem' name { 'Artem' }
end end
end end
""" """

View file

@ -70,7 +70,7 @@ RUBY
def factory_attributes def factory_attributes
attributes.map do |attribute| attributes.map do |attribute|
"#{attribute.name} #{attribute.default.inspect}" "#{attribute.name} { #{attribute.default.inspect} }"
end.join("\n") end.join("\n")
end end