factory_girl 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/Appraisals +7 -3
  2. data/GETTING_STARTED.md +28 -4
  3. data/Gemfile.lock +28 -32
  4. data/LICENSE +1 -1
  5. data/NEWS +11 -0
  6. data/README.md +2 -2
  7. data/factory_girl.gemspec +5 -5
  8. data/features/step_definitions/database_steps.rb +1 -1
  9. data/gemfiles/3.0.gemfile +1 -1
  10. data/gemfiles/3.0.gemfile.lock +40 -48
  11. data/gemfiles/3.1.gemfile +1 -1
  12. data/gemfiles/3.1.gemfile.lock +41 -49
  13. data/gemfiles/3.2.gemfile +1 -1
  14. data/gemfiles/3.2.gemfile.lock +42 -50
  15. data/gemfiles/4.0.gemfile +7 -0
  16. data/gemfiles/4.0.gemfile.lock +95 -0
  17. data/lib/factory_girl/definition_hierarchy.rb +9 -0
  18. data/lib/factory_girl/definition_proxy.rb +1 -1
  19. data/lib/factory_girl/evaluator.rb +11 -2
  20. data/lib/factory_girl/factory.rb +1 -3
  21. data/lib/factory_girl/sequence.rb +17 -3
  22. data/lib/factory_girl/strategy/stub.rb +2 -2
  23. data/lib/factory_girl/strategy_syntax_method_registrar.rb +2 -2
  24. data/lib/factory_girl/version.rb +1 -1
  25. data/spec/acceptance/activesupport_instrumentation_spec.rb +3 -3
  26. data/spec/acceptance/aliases_spec.rb +1 -1
  27. data/spec/acceptance/attribute_aliases_spec.rb +3 -3
  28. data/spec/acceptance/attribute_existing_on_object_spec.rb +8 -8
  29. data/spec/acceptance/attributes_for_spec.rb +11 -9
  30. data/spec/acceptance/attributes_from_instance_spec.rb +7 -7
  31. data/spec/acceptance/attributes_ordered_spec.rb +6 -6
  32. data/spec/acceptance/build_list_spec.rb +20 -5
  33. data/spec/acceptance/build_spec.rb +10 -13
  34. data/spec/acceptance/build_stubbed_spec.rb +38 -13
  35. data/spec/acceptance/callbacks_spec.rb +19 -19
  36. data/spec/acceptance/create_list_spec.rb +22 -7
  37. data/spec/acceptance/create_spec.rb +10 -11
  38. data/spec/acceptance/define_child_before_parent_spec.rb +1 -1
  39. data/spec/acceptance/definition_spec.rb +2 -7
  40. data/spec/acceptance/definition_without_block_spec.rb +1 -1
  41. data/spec/acceptance/global_initialize_with_spec.rb +10 -10
  42. data/spec/acceptance/global_to_create_spec.rb +18 -18
  43. data/spec/acceptance/initialize_with_spec.rb +13 -13
  44. data/spec/acceptance/keyed_by_class_spec.rb +2 -2
  45. data/spec/acceptance/modify_factories_spec.rb +21 -21
  46. data/spec/acceptance/modify_inherited_spec.rb +7 -7
  47. data/spec/acceptance/nested_attributes_spec.rb +2 -2
  48. data/spec/acceptance/overrides_spec.rb +1 -1
  49. data/spec/acceptance/parent_spec.rb +9 -9
  50. data/spec/acceptance/register_strategies_spec.rb +9 -9
  51. data/spec/acceptance/sequence_context_spec.rb +52 -0
  52. data/spec/acceptance/sequence_spec.rb +12 -12
  53. data/spec/acceptance/skip_create_spec.rb +1 -1
  54. data/spec/acceptance/stub_spec.rb +4 -4
  55. data/spec/acceptance/syntax_methods_within_dynamic_attributes_spec.rb +5 -5
  56. data/spec/acceptance/traits_spec.rb +84 -84
  57. data/spec/acceptance/transient_attributes_spec.rb +13 -13
  58. data/spec/factory_girl/attribute/association_spec.rb +4 -4
  59. data/spec/factory_girl/attribute/dynamic_spec.rb +5 -5
  60. data/spec/factory_girl/attribute/sequence_spec.rb +2 -2
  61. data/spec/factory_girl/attribute/static_spec.rb +3 -3
  62. data/spec/factory_girl/attribute_list_spec.rb +12 -12
  63. data/spec/factory_girl/attribute_spec.rb +1 -1
  64. data/spec/factory_girl/callback_spec.rb +5 -5
  65. data/spec/factory_girl/declaration/implicit_spec.rb +1 -1
  66. data/spec/factory_girl/declaration_list_spec.rb +11 -11
  67. data/spec/factory_girl/definition_proxy_spec.rb +21 -21
  68. data/spec/factory_girl/definition_spec.rb +6 -6
  69. data/spec/factory_girl/disallows_duplicates_registry_spec.rb +1 -1
  70. data/spec/factory_girl/evaluator_class_definer_spec.rb +54 -21
  71. data/spec/factory_girl/factory_spec.rb +34 -34
  72. data/spec/factory_girl/null_factory_spec.rb +1 -1
  73. data/spec/factory_girl/null_object_spec.rb +3 -3
  74. data/spec/factory_girl/registry_spec.rb +12 -12
  75. data/spec/factory_girl/sequence_spec.rb +34 -17
  76. data/spec/factory_girl/strategy/attributes_for_spec.rb +1 -1
  77. data/spec/factory_girl/strategy/create_spec.rb +1 -1
  78. data/spec/factory_girl/strategy/stub_spec.rb +4 -4
  79. data/spec/factory_girl/strategy_calculator_spec.rb +3 -3
  80. data/spec/factory_girl_spec.rb +3 -3
  81. data/spec/spec_helper.rb +1 -1
  82. data/spec/support/macros/define_constant.rb +2 -2
  83. data/spec/support/shared_examples/strategy.rb +7 -7
  84. metadata +17 -11
@@ -15,9 +15,9 @@ describe "declaring attributes on a Factory that are private methods on Object"
15
15
 
16
16
  subject { FactoryGirl.build(:website, sleep: -5) }
17
17
 
18
- its(:system) { should == false }
19
- its(:link) { should == "http://example.com" }
20
- its(:sleep) { should == -5 }
18
+ its(:system) { should eq false }
19
+ its(:link) { should eq "http://example.com" }
20
+ its(:sleep) { should eq -5 }
21
21
  end
22
22
 
23
23
  describe "assigning overrides that are also private methods on object" do
@@ -42,10 +42,10 @@ describe "assigning overrides that are also private methods on object" do
42
42
  end
43
43
 
44
44
  subject { FactoryGirl.build(:website, format: "Great", y: 12345, some_funky_method: "foobar!") }
45
- its(:format) { should == "Great" }
46
- its(:y) { should == 12345 }
47
- its(:more_format) { should == "format: Great" }
48
- its(:some_funky_method) { should == "foobar!" }
45
+ its(:format) { should eq "Great" }
46
+ its(:y) { should eq 12345 }
47
+ its(:more_format) { should eq "format: Great" }
48
+ its(:some_funky_method) { should eq "foobar!" }
49
49
  end
50
50
 
51
51
  describe "accessing methods from the instance within a dynamic attribute that is also a private method on object" do
@@ -64,5 +64,5 @@ describe "accessing methods from the instance within a dynamic attribute that is
64
64
  end
65
65
 
66
66
  subject { FactoryGirl.build(:website) }
67
- its(:more_format) { should == "format: This is an awesome format" }
67
+ its(:more_format) { should eq "format: This is an awesome format" }
68
68
  end
@@ -34,20 +34,20 @@ describe "a generated attributes hash" do
34
34
  subject { attributes_for(:post, title: 'overridden title') }
35
35
 
36
36
  it "assigns an overridden value" do
37
- subject[:title].should == "overridden title"
37
+ expect(subject[:title]).to eq "overridden title"
38
38
  end
39
39
 
40
40
  it "assigns a default value" do
41
- subject[:body].should == "default body"
41
+ expect(subject[:body]).to eq "default body"
42
42
  end
43
43
 
44
44
  it "assigns a lazy, dependent attribute" do
45
- subject[:summary].should == "overridden title"
45
+ expect(subject[:summary]).to eq "overridden title"
46
46
  end
47
47
 
48
48
  it "doesn't assign associations" do
49
- subject.should_not have_key(:user_id)
50
- subject.should_not have_key(:user)
49
+ expect(subject).not_to have_key(:user_id)
50
+ expect(subject).not_to have_key(:user)
51
51
  end
52
52
  end
53
53
 
@@ -64,16 +64,18 @@ describe "calling `attributes_for` with a block" do
64
64
 
65
65
  it "passes the hash of attributes" do
66
66
  attributes_for(:company, name: 'thoughtbot') do |attributes|
67
- attributes[:name].should eq('thoughtbot')
67
+ expect(attributes[:name]).to eq('thoughtbot')
68
68
  end
69
69
  end
70
70
 
71
71
  it "returns the hash of attributes" do
72
72
  expected = nil
73
- attributes_for(:company) do |attributes|
73
+
74
+ result = attributes_for(:company) do |attributes|
74
75
  expected = attributes
75
76
  "hello!"
76
- end.should == expected
77
+ end
78
+ expect(result).to eq expected
77
79
  end
78
80
  end
79
81
 
@@ -91,5 +93,5 @@ describe "`attributes_for` for a class whose constructor has required params" do
91
93
  end
92
94
 
93
95
  subject { FactoryGirl.attributes_for(:user) }
94
- its([:name]) { should == "John Doe" }
96
+ its([:name]) { should eq "John Doe" }
95
97
  end
@@ -17,37 +17,37 @@ describe "calling methods on the model instance" do
17
17
 
18
18
  context "without the attribute being overridden" do
19
19
  it "returns the correct value from the instance" do
20
- FactoryGirl.build(:user).age_copy.should == 18
20
+ expect(FactoryGirl.build(:user).age_copy).to eq 18
21
21
  end
22
22
 
23
23
  it "returns nil during attributes_for" do
24
- FactoryGirl.attributes_for(:user)[:age_copy].should be_nil
24
+ expect(FactoryGirl.attributes_for(:user)[:age_copy]).to be_nil
25
25
  end
26
26
 
27
27
  it "doesn't instantiate a record with attributes_for" do
28
28
  User.stubs(:new)
29
29
  FactoryGirl.attributes_for(:user)
30
- User.should have_received(:new).never
30
+ expect(User).to have_received(:new).never
31
31
  end
32
32
  end
33
33
 
34
34
  context "with the attribute being overridden" do
35
35
  it "uses the overridden value" do
36
- FactoryGirl.build(:user, age_copy: nil).age_copy.should be_nil
36
+ expect(FactoryGirl.build(:user, age_copy: nil).age_copy).to be_nil
37
37
  end
38
38
 
39
39
  it "uses the overridden value during attributes_for" do
40
- FactoryGirl.attributes_for(:user, age_copy: 25)[:age_copy].should == 25
40
+ expect(FactoryGirl.attributes_for(:user, age_copy: 25)[:age_copy]).to eq 25
41
41
  end
42
42
  end
43
43
 
44
44
  context "with the referenced attribute being overridden" do
45
45
  it "uses the overridden value" do
46
- FactoryGirl.build(:user, age: nil).age_copy.should be_nil
46
+ expect(FactoryGirl.build(:user, age: nil).age_copy).to be_nil
47
47
  end
48
48
 
49
49
  it "uses the overridden value during attributes_for" do
50
- FactoryGirl.attributes_for(:user, age: 25)[:age_copy].should == 25
50
+ expect(FactoryGirl.attributes_for(:user, age: 25)[:age_copy]).to eq 25
51
51
  end
52
52
  end
53
53
  end
@@ -33,9 +33,9 @@ describe "a generated attributes hash where order matters" do
33
33
  subject { FactoryGirl.build(:child_model) }
34
34
 
35
35
  it "assigns attributes in the order they're defined with preference to static attributes" do
36
- subject[:evaluates_first].should == 1
37
- subject[:evaluates_second].should == 1
38
- subject[:evaluates_third].should == 1
36
+ expect(subject[:evaluates_first]).to eq 1
37
+ expect(subject[:evaluates_second]).to eq 1
38
+ expect(subject[:evaluates_third]).to eq 1
39
39
  end
40
40
  end
41
41
 
@@ -43,9 +43,9 @@ describe "a generated attributes hash where order matters" do
43
43
  subject { FactoryGirl.build(:without_parent) }
44
44
 
45
45
  it "assigns attributes in the order they're defined with preference to static attributes without a parent class" do
46
- subject[:evaluates_first].should == 1
47
- subject[:evaluates_second].should == 1
48
- subject[:evaluates_third].should == 1
46
+ expect(subject[:evaluates_first]).to eq 1
47
+ expect(subject[:evaluates_second]).to eq 1
48
+ expect(subject[:evaluates_third]).to eq 1
49
49
  end
50
50
  end
51
51
  end
@@ -2,11 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe "build multiple instances" do
4
4
  before do
5
- define_model('Post', title: :string)
5
+ define_model('Post', title: :string, position: :integer)
6
6
 
7
7
  FactoryGirl.define do
8
8
  factory(:post) do |post|
9
9
  post.title "Through the Looking Glass"
10
+ post.position { rand(10**4) }
10
11
  end
11
12
  end
12
13
  end
@@ -14,17 +15,17 @@ describe "build multiple instances" do
14
15
  context "without default attributes" do
15
16
  subject { FactoryGirl.build_list(:post, 20) }
16
17
 
17
- its(:length) { should == 20 }
18
+ its(:length) { should eq 20 }
18
19
 
19
20
  it "builds (but doesn't save) all the posts" do
20
21
  subject.each do |record|
21
- record.should be_new_record
22
+ expect(record).to be_new_record
22
23
  end
23
24
  end
24
25
 
25
26
  it "uses the default factory values" do
26
27
  subject.each do |record|
27
- record.title.should == "Through the Looking Glass"
28
+ expect(record.title).to eq "Through the Looking Glass"
28
29
  end
29
30
  end
30
31
  end
@@ -34,7 +35,21 @@ describe "build multiple instances" do
34
35
 
35
36
  it "overrides the default values" do
36
37
  subject.each do |record|
37
- record.title.should == "The Hunting of the Snark"
38
+ expect(record.title).to eq "The Hunting of the Snark"
39
+ end
40
+ end
41
+ end
42
+
43
+ context "with a block" do
44
+ subject do
45
+ FactoryGirl.build_list(:post, 20, title: "The Listing of the Block") do |post|
46
+ post.position = post.id
47
+ end
48
+ end
49
+
50
+ it "correctly uses the set value" do
51
+ subject.each_with_index do |record, index|
52
+ expect(record.position).to eq record.id
38
53
  end
39
54
  end
40
55
  end
@@ -21,13 +21,11 @@ describe "a built instance" do
21
21
 
22
22
  subject { build(:post) }
23
23
 
24
- it "isn't saved" do
25
- should be_new_record
26
- end
24
+ it { should be_new_record }
27
25
 
28
26
  it "assigns and saves associations" do
29
- subject.user.should be_kind_of(User)
30
- subject.user.should_not be_new_record
27
+ expect(subject.user).to be_kind_of(User)
28
+ expect(subject.user).not_to be_new_record
31
29
  end
32
30
  end
33
31
 
@@ -52,13 +50,11 @@ describe "a built instance with strategy: :build" do
52
50
 
53
51
  subject { build(:post) }
54
52
 
55
- it "isn't saved" do
56
- should be_new_record
57
- end
53
+ it { should be_new_record }
58
54
 
59
55
  it "assigns but does not save associations" do
60
- subject.user.should be_kind_of(User)
61
- subject.user.should be_new_record
56
+ expect(subject.user).to be_kind_of(User)
57
+ expect(subject.user).to be_new_record
62
58
  end
63
59
  end
64
60
 
@@ -75,15 +71,16 @@ describe "calling `build` with a block" do
75
71
 
76
72
  it "passes the built instance" do
77
73
  build(:company, name: 'thoughtbot') do |company|
78
- company.name.should eq('thoughtbot')
74
+ expect(company.name).to eq('thoughtbot')
79
75
  end
80
76
  end
81
77
 
82
78
  it "returns the built instance" do
83
79
  expected = nil
84
- build(:company) do |company|
80
+ result = build(:company) do |company|
85
81
  expected = company
86
82
  "hello!"
87
- end.should == expected
83
+ end
84
+ expect(result).to eq expected
88
85
  end
89
86
  end
@@ -27,28 +27,28 @@ describe "a generated stub instance" do
27
27
  subject { build_stubbed(:post, title: 'overridden title') }
28
28
 
29
29
  it "assigns a default attribute" do
30
- subject.body.should == 'default body'
30
+ expect(subject.body).to eq 'default body'
31
31
  end
32
32
 
33
33
  it "assigns an overridden attribute" do
34
- subject.title.should == 'overridden title'
34
+ expect(subject.title).to eq 'overridden title'
35
35
  end
36
36
 
37
37
  it "assigns associations" do
38
- subject.user.should_not be_nil
38
+ expect(subject.user).not_to be_nil
39
39
  end
40
40
 
41
41
  it "has an id" do
42
- subject.id.should > 0
42
+ expect(subject.id).to be > 0
43
43
  end
44
44
 
45
45
  it "generates unique ids" do
46
46
  other_stub = build_stubbed(:post)
47
- subject.id.should_not == other_stub.id
47
+ expect(subject.id).not_to eq other_stub.id
48
48
  end
49
49
 
50
50
  it "isn't a new record" do
51
- should_not be_new_record
51
+ expect(subject).not_to be_new_record
52
52
  end
53
53
 
54
54
  it "disables connection" do
@@ -89,17 +89,18 @@ describe "calling `build_stubbed` with a block" do
89
89
 
90
90
  it "passes the stub instance" do
91
91
  build_stubbed(:company, name: 'thoughtbot') do |company|
92
- company.name.should eq('thoughtbot')
92
+ expect(company.name).to eq('thoughtbot')
93
93
  expect { company.save }.to raise_error(RuntimeError)
94
94
  end
95
95
  end
96
96
 
97
97
  it "returns the stub instance" do
98
98
  expected = nil
99
- build_stubbed(:company) do |company|
99
+ result = build_stubbed(:company) do |company|
100
100
  expected = company
101
101
  "hello!"
102
- end.should == expected
102
+ end
103
+ expect(result).to eq expected
103
104
  end
104
105
  end
105
106
 
@@ -115,22 +116,46 @@ describe "defaulting `created_at`" do
115
116
  factory :thing_without_timestamp
116
117
  end
117
118
 
118
- Timecop.freeze Time.now
119
+ Timecop.freeze 2012, 1, 1
119
120
  end
120
121
 
121
122
  it "defaults created_at for objects with created_at" do
122
- build_stubbed(:thing_with_timestamp).created_at.should == Time.now
123
+ expect(build_stubbed(:thing_with_timestamp).created_at).to eq Time.now
124
+ end
125
+
126
+ it "defaults created_at for objects with created_at to the correct time with zone" do
127
+ original_timezone = ENV['TZ']
128
+ ENV['TZ'] = 'UTC'
129
+ Time.zone = 'Eastern Time (US & Canada)'
130
+
131
+ expect(build_stubbed(:thing_with_timestamp).created_at.zone).to eq 'EST'
132
+
133
+ ENV['TZ'] = original_timezone
123
134
  end
124
135
 
125
136
  it "adds created_at to objects who don't have the method" do
126
- build_stubbed(:thing_without_timestamp).should respond_to(:created_at)
137
+ expect(build_stubbed(:thing_without_timestamp)).to respond_to(:created_at)
127
138
  end
128
139
 
129
140
  it "allows overriding created_at for objects with created_at" do
130
- build_stubbed(:thing_with_timestamp, created_at: 3.days.ago).created_at.should == 3.days.ago
141
+ expect(build_stubbed(:thing_with_timestamp, created_at: 3.days.ago).created_at).to eq 3.days.ago
131
142
  end
132
143
 
133
144
  it "doesn't allow setting created_at on an object that doesn't define it" do
134
145
  expect { build_stubbed(:thing_without_timestamp, :created_at => Time.now) }.to raise_error(NoMethodError, /created_at=/)
135
146
  end
136
147
  end
148
+
149
+ describe 'defaulting `id`' do
150
+ before do
151
+ define_model('Post')
152
+
153
+ FactoryGirl.define do
154
+ factory :post
155
+ end
156
+ end
157
+
158
+ it 'allows overriding id' do
159
+ expect(FactoryGirl.build_stubbed(:post, id: 12).id).to eq 12
160
+ end
161
+ end
@@ -20,29 +20,29 @@ describe "callbacks" do
20
20
 
21
21
  it "runs the after(:stub) callback when stubbing" do
22
22
  user = FactoryGirl.build_stubbed(:user_with_callbacks)
23
- user.first_name.should == 'Stubby'
23
+ expect(user.first_name).to eq 'Stubby'
24
24
  end
25
25
 
26
26
  it "runs the after(:build) callback when building" do
27
27
  user = FactoryGirl.build(:user_with_callbacks)
28
- user.first_name.should == 'Buildy'
28
+ expect(user.first_name).to eq 'Buildy'
29
29
  end
30
30
 
31
31
  it "runs both the after(:build) and after(:create) callbacks when creating" do
32
32
  user = FactoryGirl.create(:user_with_callbacks)
33
- user.first_name.should == 'Buildy'
34
- user.last_name.should == 'Createy'
33
+ expect(user.first_name).to eq 'Buildy'
34
+ expect(user.last_name).to eq 'Createy'
35
35
  end
36
36
 
37
37
  it "runs both the after(:stub) callback on the factory and the inherited after(:stub) callback" do
38
38
  user = FactoryGirl.build_stubbed(:user_with_inherited_callbacks)
39
- user.first_name.should == 'Stubby'
40
- user.last_name.should == 'Double-Stubby'
39
+ expect(user.first_name).to eq 'Stubby'
40
+ expect(user.last_name).to eq 'Double-Stubby'
41
41
  end
42
42
 
43
43
  it "runs child callback after parent callback" do
44
44
  user = FactoryGirl.build(:user_with_inherited_callbacks)
45
- user.first_name.should == 'Child-Buildy'
45
+ expect(user.first_name).to eq 'Child-Buildy'
46
46
  end
47
47
  end
48
48
 
@@ -65,15 +65,15 @@ describe "callbacks using syntax methods without referencing FactoryGirl explici
65
65
 
66
66
  it "works when the callback has no variables" do
67
67
  FactoryGirl.build_stubbed(:user)
68
- FactoryGirl.generate(:sequence_3).should == 2
68
+ expect(FactoryGirl.generate(:sequence_3)).to eq 2
69
69
  end
70
70
 
71
71
  it "works when the callback has one variable" do
72
- FactoryGirl.build(:user).first_name.should == 1
72
+ expect(FactoryGirl.build(:user).first_name).to eq 1
73
73
  end
74
74
 
75
75
  it "works when the callback has two variables" do
76
- FactoryGirl.create(:user).last_name.should == 1
76
+ expect(FactoryGirl.create(:user).last_name).to eq 1
77
77
  end
78
78
  end
79
79
 
@@ -135,18 +135,18 @@ describe "custom callbacks" do
135
135
  end
136
136
 
137
137
  it "runs a custom before callback when the proper strategy executes" do
138
- FactoryGirl.build(:user).name.should == "John Doe"
139
- FactoryGirl.custom_before(:user).name.should == "Overridden First Doe"
138
+ expect(FactoryGirl.build(:user).name).to eq "John Doe"
139
+ expect(FactoryGirl.custom_before(:user).name).to eq "Overridden First Doe"
140
140
  end
141
141
 
142
142
  it "runs a custom after callback when the proper strategy executes" do
143
- FactoryGirl.build(:user).name.should == "John Doe"
144
- FactoryGirl.custom_after(:user).name.should == "John Overridden Last"
143
+ expect(FactoryGirl.build(:user).name).to eq "John Doe"
144
+ expect(FactoryGirl.custom_after(:user).name).to eq "John Overridden Last"
145
145
  end
146
146
 
147
147
  it "runs a custom callback without prepending before or after when the proper strategy executes" do
148
- FactoryGirl.build(:user).name.should == "John Doe"
149
- FactoryGirl.totally_custom(:user).name.should == "Totally Custom"
148
+ expect(FactoryGirl.build(:user).name).to eq "John Doe"
149
+ expect(FactoryGirl.totally_custom(:user).name).to eq "Totally Custom"
150
150
  end
151
151
  end
152
152
 
@@ -164,14 +164,14 @@ describe 'binding a callback to multiple callbacks' do
164
164
  end
165
165
 
166
166
  it 'binds the callback to creation' do
167
- FactoryGirl.create(:user, name: 'John Doe').name.should == 'JOHN DOE'
167
+ expect(FactoryGirl.create(:user, name: 'John Doe').name).to eq 'JOHN DOE'
168
168
  end
169
169
 
170
170
  it 'does not bind the callback to building' do
171
- FactoryGirl.build(:user, name: 'John Doe').name.should == 'John Doe'
171
+ expect(FactoryGirl.build(:user, name: 'John Doe').name).to eq 'John Doe'
172
172
  end
173
173
 
174
174
  it 'binds the callback to stubbing' do
175
- FactoryGirl.build_stubbed(:user, name: 'John Doe').name.should == 'JOHN DOE'
175
+ expect(FactoryGirl.build_stubbed(:user, name: 'John Doe').name).to eq 'JOHN DOE'
176
176
  end
177
177
  end