factory_girl 2.6.4 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/.travis.yml +0 -3
  2. data/Appraisals +0 -4
  3. data/Changelog +0 -4
  4. data/Gemfile.lock +7 -4
  5. data/Rakefile +0 -12
  6. data/factory_girl.gemspec +3 -3
  7. data/features/support/env.rb +3 -0
  8. data/gemfiles/3.0.gemfile.lock +8 -4
  9. data/gemfiles/3.1.gemfile.lock +7 -4
  10. data/gemfiles/3.2.gemfile.lock +7 -4
  11. data/lib/factory_girl.rb +0 -1
  12. data/lib/factory_girl/attribute_assigner.rb +2 -2
  13. data/lib/factory_girl/declaration.rb +0 -5
  14. data/lib/factory_girl/definition.rb +1 -1
  15. data/lib/factory_girl/definition_proxy.rb +1 -1
  16. data/lib/factory_girl/errors.rb +1 -1
  17. data/lib/factory_girl/evaluator.rb +2 -5
  18. data/lib/factory_girl/factory.rb +4 -20
  19. data/lib/factory_girl/null_factory.rb +1 -2
  20. data/lib/factory_girl/null_object.rb +3 -15
  21. data/lib/factory_girl/sequence.rb +0 -4
  22. data/lib/factory_girl/step_definitions.rb +1 -1
  23. data/lib/factory_girl/syntax/blueprint.rb +2 -2
  24. data/lib/factory_girl/syntax/default.rb +1 -1
  25. data/lib/factory_girl/syntax/generate.rb +1 -1
  26. data/lib/factory_girl/syntax/make.rb +1 -1
  27. data/lib/factory_girl/syntax/vintage.rb +13 -32
  28. data/lib/factory_girl/trait.rb +1 -1
  29. data/lib/factory_girl/version.rb +1 -1
  30. data/spec/acceptance/aliases_spec.rb +3 -3
  31. data/spec/acceptance/attribute_aliases_spec.rb +5 -5
  32. data/spec/acceptance/attribute_existing_on_object_spec.rb +5 -5
  33. data/spec/acceptance/attributes_for_spec.rb +8 -8
  34. data/spec/acceptance/attributes_from_instance_spec.rb +5 -5
  35. data/spec/acceptance/attributes_ordered_spec.rb +5 -5
  36. data/spec/acceptance/build_list_spec.rb +2 -2
  37. data/spec/acceptance/build_spec.rb +6 -6
  38. data/spec/acceptance/build_stubbed_spec.rb +7 -7
  39. data/spec/acceptance/callbacks_spec.rb +3 -3
  40. data/spec/acceptance/create_list_spec.rb +6 -6
  41. data/spec/acceptance/create_spec.rb +13 -42
  42. data/spec/acceptance/define_child_before_parent_spec.rb +2 -2
  43. data/spec/acceptance/definition_spec.rb +2 -2
  44. data/spec/acceptance/initialize_with_spec.rb +7 -7
  45. data/spec/acceptance/modify_factories_spec.rb +5 -5
  46. data/spec/acceptance/modify_inherited_spec.rb +8 -8
  47. data/spec/acceptance/overrides_spec.rb +4 -4
  48. data/spec/acceptance/parent_spec.rb +3 -3
  49. data/spec/acceptance/stub_spec.rb +12 -41
  50. data/spec/acceptance/syntax/blueprint_spec.rb +6 -3
  51. data/spec/acceptance/syntax/generate_spec.rb +4 -4
  52. data/spec/acceptance/syntax/make_spec.rb +3 -3
  53. data/spec/acceptance/syntax/sham_spec.rb +5 -5
  54. data/spec/acceptance/syntax/vintage_spec.rb +28 -46
  55. data/spec/acceptance/traits_spec.rb +33 -33
  56. data/spec/acceptance/transient_attributes_spec.rb +7 -59
  57. data/spec/factory_girl/aliases_spec.rb +1 -1
  58. data/spec/factory_girl/attribute/association_spec.rb +2 -2
  59. data/spec/factory_girl/attribute/dynamic_spec.rb +2 -2
  60. data/spec/factory_girl/declaration_list_spec.rb +7 -7
  61. data/spec/factory_girl/definition_proxy_spec.rb +6 -6
  62. data/spec/factory_girl/definition_spec.rb +3 -3
  63. data/spec/factory_girl/evaluator_class_definer_spec.rb +5 -5
  64. data/spec/factory_girl/factory_spec.rb +19 -69
  65. data/spec/factory_girl/null_factory_spec.rb +4 -5
  66. data/spec/factory_girl/registry_spec.rb +1 -1
  67. data/spec/factory_girl/sequence_spec.rb +3 -4
  68. data/spec/factory_girl/strategy/attributes_for_spec.rb +2 -2
  69. data/spec/factory_girl/strategy/build_spec.rb +1 -1
  70. data/spec/factory_girl/strategy/create_spec.rb +1 -1
  71. data/spec/factory_girl/strategy/stub_spec.rb +2 -2
  72. data/spec/spec_helper.rb +3 -0
  73. data/spec/support/macros/define_constant.rb +2 -2
  74. data/spec/support/shared_examples/strategy.rb +12 -22
  75. metadata +32 -41
  76. data/gemfiles/2.3.gemfile.lock +0 -72
  77. data/lib/factory_girl/deprecated.rb +0 -18
  78. data/spec/acceptance/default_strategy_spec.rb +0 -24
  79. data/spec/acceptance/nested_attributes_spec.rb +0 -32
  80. data/spec/factory_girl/deprecated_spec.rb +0 -45
@@ -4,9 +4,12 @@ require 'factory_girl/syntax/blueprint'
4
4
 
5
5
  describe "a blueprint" do
6
6
  before do
7
- define_model('User', :first_name => :string, :last_name => :string, :email => :string)
7
+ define_model('User', first_name: :string, last_name: :string, email: :string)
8
+
9
+ FactoryGirl.define do
10
+ sequence(:email) { |n| "somebody#{n}@example.com" }
11
+ end
8
12
 
9
- Factory.sequence(:email) { |n| "somebody#{n}@example.com" }
10
13
  User.blueprint do
11
14
  first_name { 'Bill' }
12
15
  last_name { 'Nye' }
@@ -16,7 +19,7 @@ describe "a blueprint" do
16
19
 
17
20
  describe "after making an instance" do
18
21
  before do
19
- @instance = FactoryGirl.create(:user, :last_name => 'Rye')
22
+ @instance = FactoryGirl.create(:user, last_name: 'Rye')
20
23
  end
21
24
 
22
25
  it "uses attributes from the blueprint" do
@@ -4,7 +4,7 @@ require 'factory_girl/syntax/generate'
4
4
 
5
5
  describe "a factory using generate syntax" do
6
6
  before do
7
- define_model('User', :first_name => :string, :last_name => :string, :email => :string) do
7
+ define_model('User', first_name: :string, last_name: :string, email: :string) do
8
8
  validates_presence_of :first_name
9
9
  end
10
10
 
@@ -18,11 +18,11 @@ describe "a factory using generate syntax" do
18
18
  end
19
19
 
20
20
  it "does not raise an error when generating an invalid instance" do
21
- expect { User.generate(:first_name => nil) }.to_not raise_error
21
+ expect { User.generate(first_name: nil) }.to_not raise_error
22
22
  end
23
23
 
24
24
  it "raises an error when forcefully generating an invalid instance" do
25
- expect { User.generate!(:first_name => nil) }.to raise_error(ActiveRecord::RecordInvalid)
25
+ expect { User.generate!(first_name: nil) }.to raise_error(ActiveRecord::RecordInvalid)
26
26
  end
27
27
 
28
28
  %w(generate generate! spawn).each do |method|
@@ -34,7 +34,7 @@ describe "a factory using generate syntax" do
34
34
 
35
35
  describe "after generating an instance using #{method}" do
36
36
  before do
37
- @instance = User.send(method, :last_name => 'Rye')
37
+ @instance = User.send(method, last_name: 'Rye')
38
38
  end
39
39
 
40
40
  it "uses attributes from the factory" do
@@ -4,7 +4,7 @@ require 'factory_girl/syntax/make'
4
4
 
5
5
  describe "a factory using make syntax" do
6
6
  before do
7
- define_model('User', :first_name => :string, :last_name => :string)
7
+ define_model('User', first_name: :string, last_name: :string)
8
8
 
9
9
  FactoryGirl.define do
10
10
  factory :user do
@@ -16,7 +16,7 @@ describe "a factory using make syntax" do
16
16
 
17
17
  describe "after make" do
18
18
  before do
19
- @instance = User.make(:last_name => 'Rye')
19
+ @instance = User.make(last_name: 'Rye')
20
20
  end
21
21
 
22
22
  it "uses attributes from the factory" do
@@ -34,7 +34,7 @@ describe "a factory using make syntax" do
34
34
 
35
35
  describe "after make!" do
36
36
  before do
37
- @instance = User.make!(:last_name => 'Rye')
37
+ @instance = User.make!(last_name: 'Rye')
38
38
  end
39
39
 
40
40
  it "uses attributes from the factory" do
@@ -4,10 +4,10 @@ require 'factory_girl/syntax/sham'
4
4
 
5
5
  describe "a factory using sham syntax" do
6
6
  before do
7
- define_model('User', :first_name => :string,
8
- :last_name => :string,
9
- :email => :string,
10
- :username => :string)
7
+ define_model('User', first_name: :string,
8
+ last_name: :string,
9
+ email: :string,
10
+ username: :string)
11
11
 
12
12
  Sham.name { "Name" }
13
13
  Sham.email { "somebody#{rand(5)}@example.com" }
@@ -25,7 +25,7 @@ describe "a factory using sham syntax" do
25
25
 
26
26
  describe "after making an instance" do
27
27
  before do
28
- @instance = FactoryGirl.create(:user, :last_name => 'Rye')
28
+ @instance = FactoryGirl.create(:user, last_name: 'Rye')
29
29
  end
30
30
 
31
31
  it "supports a sham called 'name'" do
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe "vintage syntax" do
4
4
  before do
5
- define_model('User', :first_name => :string,
6
- :last_name => :string,
7
- :email => :string)
5
+ define_model('User', first_name: :string,
6
+ last_name: :string,
7
+ email: :string)
8
8
 
9
9
  Factory.sequence(:email) { |n| "somebody#{n}@example.com" }
10
10
  Factory.define :user do |factory|
@@ -16,7 +16,7 @@ describe "vintage syntax" do
16
16
 
17
17
  describe "after making an instance" do
18
18
  before do
19
- @instance = Factory(:user, :last_name => 'Rye')
19
+ @instance = Factory(:user, last_name: 'Rye')
20
20
  end
21
21
 
22
22
  it "should use attributes from the definition" do
@@ -29,14 +29,8 @@ describe "vintage syntax" do
29
29
  end
30
30
  end
31
31
 
32
- it "raises an ArgumentError when trying to use a non-existent strategy" do
33
- expect {
34
- Factory.define(:object, :default_strategy => :nonexistent) {}
35
- }.to raise_error(ArgumentError)
36
- end
37
-
38
32
  it "raises Factory::SequenceAbuseError" do
39
- Factory.define :sequence_abuser, :class => User do |factory|
33
+ Factory.define :sequence_abuser, class: User do |factory|
40
34
  factory.first_name { Factory.sequence(:name) }
41
35
  end
42
36
 
@@ -49,7 +43,7 @@ end
49
43
  describe Factory, "referencing a nonexistent factory as a parent" do
50
44
  it "raises an ArgumentError when trying to use a non-existent factory as parent" do
51
45
  expect {
52
- Factory.define(:child, :parent => :nonexsitent) {}
46
+ Factory.define(:child, parent: :nonexsitent) {}
53
47
  Factory.build(:child)
54
48
  }.to raise_error(ArgumentError)
55
49
  end
@@ -58,15 +52,15 @@ end
58
52
  describe "defining a factory" do
59
53
  before do
60
54
  @name = :user
61
- @factory = stub("factory", :names => [@name])
55
+ @factory = stub("factory", names: [@name])
62
56
  @proxy = "proxy"
63
- @options = { :class => 'magic' }
64
- FactoryGirl::Factory.stubs(:new => @factory)
65
- FactoryGirl::DefinitionProxy.stubs(:new => @proxy)
57
+ @options = { class: 'magic' }
58
+ FactoryGirl::Factory.stubs(new: @factory)
59
+ FactoryGirl::DefinitionProxy.stubs(new: @proxy)
66
60
  end
67
61
 
68
62
  it "creates a new factory using the specified name and options" do
69
- FactoryGirl::Factory.stubs(:new => @factory)
63
+ FactoryGirl::Factory.stubs(new: @factory)
70
64
  Factory.define(@name, @options) {|f| }
71
65
  FactoryGirl::Factory.should have_received(:new).with(@name, @options)
72
66
  end
@@ -94,39 +88,27 @@ describe "after defining a factory" do
94
88
  end
95
89
 
96
90
  it "uses Strategy::AttributesFor for Factory.attributes_for" do
97
- @factory.stubs(:run => "result")
98
- Factory.attributes_for(@name, :attr => 'value').should == 'result'
99
- @factory.should have_received(:run).with(FactoryGirl::Strategy::AttributesFor, :attr => 'value')
91
+ @factory.stubs(run: "result")
92
+ Factory.attributes_for(@name, attr: 'value').should == 'result'
93
+ @factory.should have_received(:run).with(FactoryGirl::Strategy::AttributesFor, attr: 'value')
100
94
  end
101
95
 
102
96
  it "uses Strategy::Build for Factory.build" do
103
- @factory.stubs(:run => "result")
104
- Factory.build(@name, :attr => 'value').should == 'result'
105
- @factory.should have_received(:run).with(FactoryGirl::Strategy::Build, :attr => 'value')
97
+ @factory.stubs(run: "result")
98
+ Factory.build(@name, attr: 'value').should == 'result'
99
+ @factory.should have_received(:run).with(FactoryGirl::Strategy::Build, attr: 'value')
106
100
  end
107
101
 
108
102
  it "uses Strategy::Create for Factory.create" do
109
- @factory.stubs(:run => "result")
110
- Factory.create(@name, :attr => 'value').should == 'result'
111
- @factory.should have_received(:run).with(FactoryGirl::Strategy::Create, :attr => 'value')
103
+ @factory.stubs(run: "result")
104
+ Factory.create(@name, attr: 'value').should == 'result'
105
+ @factory.should have_received(:run).with(FactoryGirl::Strategy::Create, attr: 'value')
112
106
  end
113
107
 
114
108
  it "uses Strategy::Stub for Factory.stub" do
115
- @factory.stubs(:run => "result")
116
- Factory.stub(@name, :attr => 'value').should == 'result'
117
- @factory.should have_received(:run).with(FactoryGirl::Strategy::Stub, :attr => 'value')
118
- end
119
-
120
- it "uses default strategy option as Factory.default_strategy" do
121
- @factory.stubs(:default_strategy => :create, :run => "result")
122
- Factory.default_strategy(@name, :attr => 'value').should == 'result'
123
- @factory.should have_received(:run).with(FactoryGirl::Strategy::Create, :attr => 'value')
124
- end
125
-
126
- it "uses the default strategy for the global Factory method" do
127
- @factory.stubs(:default_strategy => :create, :run => "result")
128
- Factory(@name, :attr => 'value').should == 'result'
129
- @factory.should have_received(:run).with(FactoryGirl::Strategy::Create, :attr => 'value')
109
+ @factory.stubs(run: "result")
110
+ Factory.stub(@name, attr: 'value').should == 'result'
111
+ @factory.should have_received(:run).with(FactoryGirl::Strategy::Stub, attr: 'value')
130
112
  end
131
113
 
132
114
  [:build, :create, :attributes_for, :stub].each do |method|
@@ -169,8 +151,8 @@ describe "after defining a sequence" do
169
151
  @sequence = FactoryGirl::Sequence.new(@name) {}
170
152
  @value = '1 2 5'
171
153
 
172
- @sequence.stubs(:next => @value)
173
- FactoryGirl::Sequence.stubs(:new => @sequence)
154
+ @sequence.stubs(next: @value)
155
+ FactoryGirl::Sequence.stubs(new: @sequence)
174
156
 
175
157
  Factory.sequence(@name) {}
176
158
  end
@@ -187,7 +169,7 @@ end
187
169
 
188
170
  describe "an attribute generated by an in-line sequence" do
189
171
  before do
190
- define_model('User', :username => :string)
172
+ define_model('User', username: :string)
191
173
 
192
174
  Factory.define :user do |factory|
193
175
  factory.sequence(:username) { |n| "username#{n}" }
@@ -218,13 +200,13 @@ end
218
200
 
219
201
  describe "a factory with a parent" do
220
202
  before do
221
- define_model("User", :username => :string)
203
+ define_model("User", username: :string)
222
204
 
223
205
  Factory.define(:user) do |factory|
224
206
  factory.username "awesome_username"
225
207
  end
226
208
 
227
- Factory.define(:boring_user, :parent => :user) do |factory|
209
+ Factory.define(:boring_user, parent: :user) do |factory|
228
210
  factory.username "boring_username"
229
211
  end
230
212
  end
@@ -3,15 +3,15 @@ require "spec_helper"
3
3
  describe "an instance generated by a factory with multiple traits" do
4
4
  before do
5
5
  define_model("User",
6
- :name => :string,
7
- :admin => :boolean,
8
- :gender => :string,
9
- :email => :string,
10
- :date_of_birth => :date,
11
- :great => :string)
6
+ name: :string,
7
+ admin: :boolean,
8
+ gender: :string,
9
+ email: :string,
10
+ date_of_birth: :date,
11
+ great: :string)
12
12
 
13
13
  FactoryGirl.define do
14
- factory :user_without_admin_scoping, :class => User do
14
+ factory :user_without_admin_scoping, class: User do
15
15
  admin_trait
16
16
  end
17
17
 
@@ -44,7 +44,7 @@ describe "an instance generated by a factory with multiple traits" do
44
44
  great
45
45
  end
46
46
 
47
- factory :admin, :traits => [:admin]
47
+ factory :admin, traits: [:admin]
48
48
 
49
49
  factory :male_user do
50
50
  male
@@ -54,7 +54,7 @@ describe "an instance generated by a factory with multiple traits" do
54
54
  end
55
55
  end
56
56
 
57
- factory :female, :traits => [:female] do
57
+ factory :female, traits: [:female] do
58
58
  trait :admin do
59
59
  admin true
60
60
  name "Judy"
@@ -64,19 +64,19 @@ describe "an instance generated by a factory with multiple traits" do
64
64
  great
65
65
  end
66
66
 
67
- factory :female_admin_judy, :traits => [:admin]
67
+ factory :female_admin_judy, traits: [:admin]
68
68
  end
69
69
 
70
- factory :female_admin, :traits => [:female, :admin]
71
- factory :female_after_male_admin, :traits => [:male, :female, :admin]
72
- factory :male_after_female_admin, :traits => [:female, :male, :admin]
70
+ factory :female_admin, traits: [:female, :admin]
71
+ factory :female_after_male_admin, traits: [:male, :female, :admin]
72
+ factory :male_after_female_admin, traits: [:female, :male, :admin]
73
73
  end
74
74
 
75
75
  trait :email do
76
76
  email { "#{name}@example.com" }
77
77
  end
78
78
 
79
- factory :user_with_email, :class => User, :traits => [:email] do
79
+ factory :user_with_email, class: User, traits: [:email] do
80
80
  name "Bill"
81
81
  end
82
82
  end
@@ -111,7 +111,7 @@ describe "an instance generated by a factory with multiple traits" do
111
111
  end
112
112
 
113
113
  context "the child with multiple traits and overridden attributes" do
114
- subject { FactoryGirl.create(:female_admin, :name => "Jill", :gender => nil) }
114
+ subject { FactoryGirl.create(:female_admin, name: "Jill", gender: nil) }
115
115
  its(:name) { should == "Jill" }
116
116
  its(:gender) { should be_nil }
117
117
  it { should be_admin }
@@ -157,7 +157,7 @@ describe "an instance generated by a factory with multiple traits" do
157
157
  end
158
158
 
159
159
  context "factory created with alternate syntax where trait name and attribute are the same and attribute is overridden" do
160
- subject { FactoryGirl.create(:great_user, :great => "SORT OF!!!") }
160
+ subject { FactoryGirl.create(:great_user, great: "SORT OF!!!") }
161
161
  its(:great) { should == "SORT OF!!!" }
162
162
  end
163
163
 
@@ -180,7 +180,7 @@ end
180
180
 
181
181
  describe "traits with callbacks" do
182
182
  before do
183
- define_model("User", :name => :string)
183
+ define_model("User", name: :string)
184
184
 
185
185
  FactoryGirl.define do
186
186
  factory :user do
@@ -194,8 +194,8 @@ describe "traits with callbacks" do
194
194
  after_create {|user| user.name = "awesome" }
195
195
  end
196
196
 
197
- factory :caps_user, :traits => [:great]
198
- factory :awesome_user, :traits => [:great, :awesome]
197
+ factory :caps_user, traits: [:great]
198
+ factory :awesome_user, traits: [:great, :awesome]
199
199
 
200
200
  factory :caps_user_implicit_trait do
201
201
  great
@@ -221,7 +221,7 @@ end
221
221
 
222
222
  describe "traits added via strategy" do
223
223
  before do
224
- define_model("User", :name => :string, :admin => :boolean)
224
+ define_model("User", name: :string, admin: :boolean)
225
225
 
226
226
  FactoryGirl.define do
227
227
  factory :user do
@@ -239,7 +239,7 @@ describe "traits added via strategy" do
239
239
  end
240
240
 
241
241
  context "adding traits in create" do
242
- subject { FactoryGirl.create(:user, :admin, :great, :name => "Joe") }
242
+ subject { FactoryGirl.create(:user, :admin, :great, name: "Joe") }
243
243
 
244
244
  its(:admin) { should be_true }
245
245
  its(:name) { should == "JOE" }
@@ -252,7 +252,7 @@ describe "traits added via strategy" do
252
252
  end
253
253
 
254
254
  context "adding traits in build" do
255
- subject { FactoryGirl.build(:user, :admin, :great, :name => "Joe") }
255
+ subject { FactoryGirl.build(:user, :admin, :great, name: "Joe") }
256
256
 
257
257
  its(:admin) { should be_true }
258
258
  its(:name) { should == "Joe" }
@@ -266,14 +266,14 @@ describe "traits added via strategy" do
266
266
  end
267
267
 
268
268
  context "adding traits in build_stubbed" do
269
- subject { FactoryGirl.build_stubbed(:user, :admin, :great, :name => "Jack") }
269
+ subject { FactoryGirl.build_stubbed(:user, :admin, :great, name: "Jack") }
270
270
 
271
271
  its(:admin) { should be_true }
272
272
  its(:name) { should == "Jack" }
273
273
  end
274
274
 
275
275
  context "adding traits in create_list" do
276
- subject { FactoryGirl.create_list(:user, 2, :admin, :great, :name => "Joe") }
276
+ subject { FactoryGirl.create_list(:user, 2, :admin, :great, name: "Joe") }
277
277
 
278
278
  its(:length) { should == 2 }
279
279
 
@@ -286,7 +286,7 @@ describe "traits added via strategy" do
286
286
  end
287
287
 
288
288
  context "adding traits in build_list" do
289
- subject { FactoryGirl.build_list(:user, 2, :admin, :great, :name => "Joe") }
289
+ subject { FactoryGirl.build_list(:user, 2, :admin, :great, name: "Joe") }
290
290
 
291
291
  its(:length) { should == 2 }
292
292
 
@@ -301,7 +301,7 @@ end
301
301
 
302
302
  describe "traits and dynamic attributes that are applied simultaneously" do
303
303
  before do
304
- define_model("User", :name => :string, :email => :string, :combined => :string)
304
+ define_model("User", name: :string, email: :string, combined: :string)
305
305
 
306
306
  FactoryGirl.define do
307
307
  trait :email do
@@ -328,7 +328,7 @@ describe "applying inline traits" do
328
328
  has_many :posts
329
329
  end
330
330
 
331
- define_model("Post", :user_id => :integer) do
331
+ define_model("Post", user_id: :integer) do
332
332
  belongs_to :user
333
333
  end
334
334
 
@@ -350,7 +350,7 @@ end
350
350
 
351
351
  describe "inline traits overriding existing attributes" do
352
352
  before do
353
- define_model("User", :status => :string)
353
+ define_model("User", status: :string)
354
354
 
355
355
  FactoryGirl.define do
356
356
  factory :user do
@@ -359,8 +359,8 @@ describe "inline traits overriding existing attributes" do
359
359
  trait(:accepted) { status "accepted" }
360
360
  trait(:declined) { status "declined" }
361
361
 
362
- factory :declined_user, :traits => [:declined]
363
- factory :extended_declined_user, :traits => [:declined] do
362
+ factory :declined_user, traits: [:declined]
363
+ factory :extended_declined_user, traits: [:declined] do
364
364
  status "extended_declined"
365
365
  end
366
366
  end
@@ -392,13 +392,13 @@ describe "inline traits overriding existing attributes" do
392
392
  end
393
393
 
394
394
  it "prefers overridden attributes over attributes from traits, inline traits, or attributes on factories" do
395
- FactoryGirl.build(:extended_declined_user, :accepted, :status => "completely overridden").status.should == "completely overridden"
395
+ FactoryGirl.build(:extended_declined_user, :accepted, status: "completely overridden").status.should == "completely overridden"
396
396
  end
397
397
  end
398
398
 
399
399
  describe "making sure the factory is properly compiled the first time we want to instantiate it" do
400
400
  before do
401
- define_model("User", :role => :string, :gender => :string, :age => :integer)
401
+ define_model("User", role: :string, gender: :string, age: :integer)
402
402
 
403
403
  FactoryGirl.define do
404
404
  factory :user do
@@ -413,7 +413,7 @@ describe "making sure the factory is properly compiled the first time we want to
413
413
  end
414
414
 
415
415
  it "can honor traits on the very first call" do
416
- user = FactoryGirl.build(:female_user, :admin, :age => 30)
416
+ user = FactoryGirl.build(:female_user, :admin, age: 30)
417
417
  user.gender.should == 'female'
418
418
  user.age.should == 30
419
419
  user.role.should == 'admin'