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.
- data/.travis.yml +0 -3
- data/Appraisals +0 -4
- data/Changelog +0 -4
- data/Gemfile.lock +7 -4
- data/Rakefile +0 -12
- data/factory_girl.gemspec +3 -3
- data/features/support/env.rb +3 -0
- data/gemfiles/3.0.gemfile.lock +8 -4
- data/gemfiles/3.1.gemfile.lock +7 -4
- data/gemfiles/3.2.gemfile.lock +7 -4
- data/lib/factory_girl.rb +0 -1
- data/lib/factory_girl/attribute_assigner.rb +2 -2
- data/lib/factory_girl/declaration.rb +0 -5
- data/lib/factory_girl/definition.rb +1 -1
- data/lib/factory_girl/definition_proxy.rb +1 -1
- data/lib/factory_girl/errors.rb +1 -1
- data/lib/factory_girl/evaluator.rb +2 -5
- data/lib/factory_girl/factory.rb +4 -20
- data/lib/factory_girl/null_factory.rb +1 -2
- data/lib/factory_girl/null_object.rb +3 -15
- data/lib/factory_girl/sequence.rb +0 -4
- data/lib/factory_girl/step_definitions.rb +1 -1
- data/lib/factory_girl/syntax/blueprint.rb +2 -2
- data/lib/factory_girl/syntax/default.rb +1 -1
- data/lib/factory_girl/syntax/generate.rb +1 -1
- data/lib/factory_girl/syntax/make.rb +1 -1
- data/lib/factory_girl/syntax/vintage.rb +13 -32
- data/lib/factory_girl/trait.rb +1 -1
- data/lib/factory_girl/version.rb +1 -1
- data/spec/acceptance/aliases_spec.rb +3 -3
- data/spec/acceptance/attribute_aliases_spec.rb +5 -5
- data/spec/acceptance/attribute_existing_on_object_spec.rb +5 -5
- data/spec/acceptance/attributes_for_spec.rb +8 -8
- data/spec/acceptance/attributes_from_instance_spec.rb +5 -5
- data/spec/acceptance/attributes_ordered_spec.rb +5 -5
- data/spec/acceptance/build_list_spec.rb +2 -2
- data/spec/acceptance/build_spec.rb +6 -6
- data/spec/acceptance/build_stubbed_spec.rb +7 -7
- data/spec/acceptance/callbacks_spec.rb +3 -3
- data/spec/acceptance/create_list_spec.rb +6 -6
- data/spec/acceptance/create_spec.rb +13 -42
- data/spec/acceptance/define_child_before_parent_spec.rb +2 -2
- data/spec/acceptance/definition_spec.rb +2 -2
- data/spec/acceptance/initialize_with_spec.rb +7 -7
- data/spec/acceptance/modify_factories_spec.rb +5 -5
- data/spec/acceptance/modify_inherited_spec.rb +8 -8
- data/spec/acceptance/overrides_spec.rb +4 -4
- data/spec/acceptance/parent_spec.rb +3 -3
- data/spec/acceptance/stub_spec.rb +12 -41
- data/spec/acceptance/syntax/blueprint_spec.rb +6 -3
- data/spec/acceptance/syntax/generate_spec.rb +4 -4
- data/spec/acceptance/syntax/make_spec.rb +3 -3
- data/spec/acceptance/syntax/sham_spec.rb +5 -5
- data/spec/acceptance/syntax/vintage_spec.rb +28 -46
- data/spec/acceptance/traits_spec.rb +33 -33
- data/spec/acceptance/transient_attributes_spec.rb +7 -59
- data/spec/factory_girl/aliases_spec.rb +1 -1
- data/spec/factory_girl/attribute/association_spec.rb +2 -2
- data/spec/factory_girl/attribute/dynamic_spec.rb +2 -2
- data/spec/factory_girl/declaration_list_spec.rb +7 -7
- data/spec/factory_girl/definition_proxy_spec.rb +6 -6
- data/spec/factory_girl/definition_spec.rb +3 -3
- data/spec/factory_girl/evaluator_class_definer_spec.rb +5 -5
- data/spec/factory_girl/factory_spec.rb +19 -69
- data/spec/factory_girl/null_factory_spec.rb +4 -5
- data/spec/factory_girl/registry_spec.rb +1 -1
- data/spec/factory_girl/sequence_spec.rb +3 -4
- data/spec/factory_girl/strategy/attributes_for_spec.rb +2 -2
- data/spec/factory_girl/strategy/build_spec.rb +1 -1
- data/spec/factory_girl/strategy/create_spec.rb +1 -1
- data/spec/factory_girl/strategy/stub_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -0
- data/spec/support/macros/define_constant.rb +2 -2
- data/spec/support/shared_examples/strategy.rb +12 -22
- metadata +32 -41
- data/gemfiles/2.3.gemfile.lock +0 -72
- data/lib/factory_girl/deprecated.rb +0 -18
- data/spec/acceptance/default_strategy_spec.rb +0 -24
- data/spec/acceptance/nested_attributes_spec.rb +0 -32
- data/spec/factory_girl/deprecated_spec.rb +0 -45
@@ -40,7 +40,7 @@ module FactoryGirlStepHelpers
|
|
40
40
|
return unless association
|
41
41
|
|
42
42
|
if attributes_hash = nested_attribute_hash
|
43
|
-
factory.build_class.first(:
|
43
|
+
factory.build_class.first(conditions: attributes_hash.attributes(FindAttributes)) or
|
44
44
|
FactoryGirl.create(association.factory, attributes_hash.attributes)
|
45
45
|
end
|
46
46
|
end
|
@@ -13,7 +13,7 @@ module FactoryGirl
|
|
13
13
|
# email { 'billy@bob.example.com' }
|
14
14
|
# end
|
15
15
|
#
|
16
|
-
# FactoryGirl.create(:user, :
|
16
|
+
# FactoryGirl.create(:user, name: 'Johnny')
|
17
17
|
#
|
18
18
|
# This syntax was derived from Pete Yandell's machinist.
|
19
19
|
module Blueprint
|
@@ -26,7 +26,7 @@ module FactoryGirl
|
|
26
26
|
module ClassMethods #:nodoc:
|
27
27
|
|
28
28
|
def blueprint(&block)
|
29
|
-
instance = Factory.new(name.underscore, :
|
29
|
+
instance = Factory.new(name.underscore, class: self)
|
30
30
|
proxy = FactoryGirl::DefinitionProxy.new(instance)
|
31
31
|
proxy.instance_eval(&block)
|
32
32
|
FactoryGirl.register_factory(instance)
|
@@ -25,7 +25,7 @@ module FactoryGirl
|
|
25
25
|
|
26
26
|
proxy.child_factories.each do |(child_name, child_options, child_block)|
|
27
27
|
parent_factory = child_options.delete(:parent) || name
|
28
|
-
factory(child_name, child_options.merge(:
|
28
|
+
factory(child_name, child_options.merge(parent: parent_factory), &child_block)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -16,7 +16,7 @@ module FactoryGirl
|
|
16
16
|
#
|
17
17
|
# # Creates a saved instance without raising (same as saving the result
|
18
18
|
# # of FactoryGirl.build)
|
19
|
-
# User.generate(:
|
19
|
+
# User.generate(name: 'Johnny')
|
20
20
|
#
|
21
21
|
# # Creates a saved instance and raises when invalid (same as
|
22
22
|
# # FactoryGirl.create)
|
@@ -17,39 +17,17 @@ module FactoryGirl
|
|
17
17
|
# The parent factory. If specified, the attributes from the parent
|
18
18
|
# factory will be copied to the current one with an ability to override
|
19
19
|
# them.
|
20
|
-
# * default_strategy: +Symbol+
|
21
|
-
# DEPRECATED.
|
22
|
-
# The strategy that will be used by the Factory shortcut method.
|
23
|
-
# Defaults to :create.
|
24
20
|
#
|
25
21
|
# Yields: +Factory+
|
26
22
|
# The newly created factory.
|
27
23
|
def self.define(name, options = {})
|
24
|
+
$stderr.puts "DEPRECATION WARNING: Factory.define is deprecated; use the FactoryGirl.define block syntax to declare your factory."
|
28
25
|
factory = FactoryGirl::Factory.new(name, options)
|
29
26
|
proxy = FactoryGirl::DefinitionProxy.new(factory)
|
30
27
|
yield(proxy)
|
31
28
|
FactoryGirl.register_factory(factory)
|
32
29
|
end
|
33
30
|
|
34
|
-
# Executes the default strategy for the given factory. This is usually create,
|
35
|
-
# but it can be overridden for each factory.
|
36
|
-
#
|
37
|
-
# DEPRECATED
|
38
|
-
#
|
39
|
-
# Use create instead.
|
40
|
-
#
|
41
|
-
# Arguments:
|
42
|
-
# * name: +Symbol+ or +String+
|
43
|
-
# The name of the factory that should be used.
|
44
|
-
# * overrides: +Hash+
|
45
|
-
# Attributes to overwrite for this instance.
|
46
|
-
#
|
47
|
-
# Returns: +Object+
|
48
|
-
# The result of the default strategy.
|
49
|
-
def self.default_strategy(name, overrides = {})
|
50
|
-
FactoryGirl.send(FactoryGirl.factory_by_name(name).default_strategy, name, overrides)
|
51
|
-
end
|
52
|
-
|
53
31
|
# Defines a new sequence that can be used to generate unique values in a specific format.
|
54
32
|
#
|
55
33
|
# Arguments:
|
@@ -66,6 +44,7 @@ module FactoryGirl
|
|
66
44
|
#
|
67
45
|
# Factory.sequence(:email) {|n| "somebody_#{n}@example.com" }
|
68
46
|
def self.sequence(name, start_value = 1, &block)
|
47
|
+
$stderr.puts "DEPRECATION WARNING: Factory.sequence is deprecated; use the FactoryGirl.define block syntax to declare your sequence."
|
69
48
|
FactoryGirl.register_sequence(Sequence.new(name, start_value, &block))
|
70
49
|
end
|
71
50
|
|
@@ -78,6 +57,7 @@ module FactoryGirl
|
|
78
57
|
# Returns:
|
79
58
|
# The next value in the sequence. (Object)
|
80
59
|
def self.next(name)
|
60
|
+
$stderr.puts "DEPRECATION WARNING: Factory.next is deprecated; use FactoryGirl.generate instead."
|
81
61
|
FactoryGirl.generate(name)
|
82
62
|
end
|
83
63
|
|
@@ -104,43 +84,44 @@ module FactoryGirl
|
|
104
84
|
#
|
105
85
|
# # The user association will not be built in this example. The user_id
|
106
86
|
# # will be used instead.
|
107
|
-
# Factory(:post, :
|
87
|
+
# Factory(:post, user_id: 1)
|
108
88
|
def self.alias(pattern, replace)
|
89
|
+
$stderr.puts "DEPRECATION WARNING: Factory.alias is deprecated; use FactoryGirl.aliases << [pattern, replace] instead."
|
109
90
|
FactoryGirl.aliases << [pattern, replace]
|
110
91
|
end
|
111
92
|
|
112
93
|
# Alias for FactoryGirl.attributes_for
|
113
94
|
def self.attributes_for(name, overrides = {})
|
95
|
+
$stderr.puts "DEPRECATION WARNING: Factory.attributes_for is deprecated; use FactoryGirl.attributes_for instead."
|
114
96
|
FactoryGirl.attributes_for(name, overrides)
|
115
97
|
end
|
116
98
|
|
117
99
|
# Alias for FactoryGirl.build
|
118
100
|
def self.build(name, overrides = {})
|
101
|
+
$stderr.puts "DEPRECATION WARNING: Factory.build is deprecated; use FactoryGirl.build instead."
|
119
102
|
FactoryGirl.build(name, overrides)
|
120
103
|
end
|
121
104
|
|
122
105
|
# Alias for FactoryGirl.create
|
123
106
|
def self.create(name, overrides = {})
|
107
|
+
$stderr.puts "DEPRECATION WARNING: Factory.create is deprecated; use FactoryGirl.create instead."
|
124
108
|
FactoryGirl.create(name, overrides)
|
125
109
|
end
|
126
110
|
|
127
111
|
# Alias for FactoryGirl.build_stubbed.
|
128
112
|
def self.stub(name, overrides = {})
|
113
|
+
$stderr.puts "DEPRECATION WARNING: Factory.stub is deprecated; use FactoryGirl.build_stubbed instead."
|
129
114
|
FactoryGirl.build_stubbed(name, overrides)
|
130
115
|
end
|
131
116
|
end
|
132
117
|
|
133
|
-
# Shortcut for Factory.
|
134
|
-
#
|
135
|
-
# DEPRECATION WARNING:
|
136
|
-
#
|
137
|
-
# In a future release, default_strategy will be removed and this will
|
138
|
-
# simply call create instead.
|
118
|
+
# Shortcut for Factory.create.
|
139
119
|
#
|
140
120
|
# Example:
|
141
|
-
# Factory(:user, :
|
121
|
+
# Factory(:user, name: 'Joe')
|
142
122
|
def Factory(name, attrs = {})
|
143
|
-
|
123
|
+
$stderr.puts "DEPRECATION WARNING: Factory(:name) is deprecated; use FactoryGirl.create(:name) instead."
|
124
|
+
FactoryGirl.create(name, attrs)
|
144
125
|
end
|
145
126
|
end
|
146
127
|
end
|
data/lib/factory_girl/trait.rb
CHANGED
data/lib/factory_girl/version.rb
CHANGED
@@ -2,9 +2,9 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "aliases and overrides" do
|
4
4
|
before do
|
5
|
-
|
5
|
+
FactoryGirl.aliases << [/one/, "two"]
|
6
6
|
|
7
|
-
define_model("User", :
|
7
|
+
define_model("User", two: :string, one: :string)
|
8
8
|
|
9
9
|
FactoryGirl.define do
|
10
10
|
factory :user do
|
@@ -13,7 +13,7 @@ describe "aliases and overrides" do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
subject { FactoryGirl.create(:user, :
|
16
|
+
subject { FactoryGirl.create(:user, one: "override") }
|
17
17
|
its(:one) { should == "override" }
|
18
18
|
its(:two) { should be_nil }
|
19
19
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "attribute aliases" do
|
4
4
|
before do
|
5
|
-
define_model('User', :
|
5
|
+
define_model('User', name: :string, age: :integer)
|
6
6
|
|
7
|
-
define_model('Post', :
|
7
|
+
define_model('Post', user_id: :integer) do
|
8
8
|
belongs_to :user
|
9
9
|
end
|
10
10
|
|
@@ -19,14 +19,14 @@ describe "attribute aliases" do
|
|
19
19
|
user
|
20
20
|
end
|
21
21
|
|
22
|
-
factory :post_with_named_user, :
|
23
|
-
user :
|
22
|
+
factory :post_with_named_user, class: Post do
|
23
|
+
user factory: :user_with_name, age: 20
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
context "assigning an association by foreign key" do
|
29
|
-
subject { FactoryGirl.build(:post, :
|
29
|
+
subject { FactoryGirl.build(:post, user_id: 1) }
|
30
30
|
|
31
31
|
it "doesn't assign both an association and its foreign key" do
|
32
32
|
subject.user_id.should == 1
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "declaring attributes on a Factory that are private methods on Object" do
|
4
4
|
before do
|
5
|
-
define_model("Website", :
|
5
|
+
define_model("Website", system: :boolean, link: :string, sleep: :integer)
|
6
6
|
|
7
7
|
FactoryGirl.define do
|
8
8
|
factory :website do
|
@@ -13,7 +13,7 @@ describe "declaring attributes on a Factory that are private methods on Object"
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
subject { FactoryGirl.build(:website, :
|
16
|
+
subject { FactoryGirl.build(:website, sleep: -5) }
|
17
17
|
|
18
18
|
its(:system) { should == false }
|
19
19
|
its(:link) { should == "http://example.com" }
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
describe "assigning overrides that are also private methods on object" do
|
24
24
|
before do
|
25
|
-
define_model("Website", :
|
25
|
+
define_model("Website", format: :string, y: :integer, more_format: :string, some_funky_method: :string)
|
26
26
|
|
27
27
|
Object.class_eval do
|
28
28
|
private
|
@@ -41,7 +41,7 @@ describe "assigning overrides that are also private methods on object" do
|
|
41
41
|
Object.send(:undef_method, :some_funky_method)
|
42
42
|
end
|
43
43
|
|
44
|
-
subject { FactoryGirl.build(:website, :
|
44
|
+
subject { FactoryGirl.build(:website, format: "Great", y: 12345, some_funky_method: "foobar!") }
|
45
45
|
its(:format) { should == "Great" }
|
46
46
|
its(:y) { should == 12345 }
|
47
47
|
its(:more_format) { should == "format: Great" }
|
@@ -50,7 +50,7 @@ end
|
|
50
50
|
|
51
51
|
describe "accessing methods from the instance within a dynamic attribute that is also a private method on object" do
|
52
52
|
before do
|
53
|
-
define_model("Website", :
|
53
|
+
define_model("Website", more_format: :string) do
|
54
54
|
def format
|
55
55
|
"This is an awesome format"
|
56
56
|
end
|
@@ -6,10 +6,10 @@ describe "a generated attributes hash" do
|
|
6
6
|
before do
|
7
7
|
define_model('User')
|
8
8
|
|
9
|
-
define_model('Post', :
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
9
|
+
define_model('Post', title: :string,
|
10
|
+
body: :string,
|
11
|
+
summary: :string,
|
12
|
+
user_id: :integer) do
|
13
13
|
belongs_to :user
|
14
14
|
end
|
15
15
|
|
@@ -25,7 +25,7 @@ describe "a generated attributes hash" do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
subject { attributes_for(:post, :
|
28
|
+
subject { attributes_for(:post, title: 'overridden title') }
|
29
29
|
|
30
30
|
it "assigns an overridden value" do
|
31
31
|
subject[:title].should == "overridden title"
|
@@ -49,7 +49,7 @@ describe "calling `attributes_for` with a block" do
|
|
49
49
|
include FactoryGirl::Syntax::Methods
|
50
50
|
|
51
51
|
before do
|
52
|
-
define_model('Company', :
|
52
|
+
define_model('Company', name: :string)
|
53
53
|
|
54
54
|
FactoryGirl.define do
|
55
55
|
factory :company
|
@@ -57,7 +57,7 @@ describe "calling `attributes_for` with a block" do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it "passes the hash of attributes" do
|
60
|
-
attributes_for(:company, :
|
60
|
+
attributes_for(:company, name: 'thoughtbot') do |attributes|
|
61
61
|
attributes[:name].should eq('thoughtbot')
|
62
62
|
end
|
63
63
|
end
|
@@ -73,7 +73,7 @@ end
|
|
73
73
|
|
74
74
|
describe "`attributes_for` for a class whose constructor has required params" do
|
75
75
|
before do
|
76
|
-
define_model("User", :
|
76
|
+
define_model("User", name: :string) do
|
77
77
|
def initialize(arg1, arg2); end
|
78
78
|
end
|
79
79
|
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "calling methods on the model instance" do
|
4
4
|
before do
|
5
|
-
define_model('User', :
|
5
|
+
define_model('User', age: :integer, age_copy: :integer) do
|
6
6
|
def age
|
7
7
|
read_attribute(:age) || 18
|
8
8
|
end
|
@@ -33,21 +33,21 @@ describe "calling methods on the model instance" do
|
|
33
33
|
|
34
34
|
context "with the attribute being overridden" do
|
35
35
|
it "uses the overridden value" do
|
36
|
-
FactoryGirl.build(:user, :
|
36
|
+
FactoryGirl.build(:user, age_copy: nil).age_copy.should be_nil
|
37
37
|
end
|
38
38
|
|
39
39
|
it "uses the overridden value during attributes_for" do
|
40
|
-
FactoryGirl.attributes_for(:user, :
|
40
|
+
FactoryGirl.attributes_for(:user, age_copy: 25)[:age_copy].should == 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, :
|
46
|
+
FactoryGirl.build(:user, age: nil).age_copy.should be_nil
|
47
47
|
end
|
48
48
|
|
49
49
|
it "uses the overridden value during attributes_for" do
|
50
|
-
FactoryGirl.attributes_for(:user, :
|
50
|
+
FactoryGirl.attributes_for(:user, age: 25)[:age_copy].should == 25
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -4,10 +4,10 @@ describe "a generated attributes hash where order matters" do
|
|
4
4
|
include FactoryGirl::Syntax::Methods
|
5
5
|
|
6
6
|
before do
|
7
|
-
define_model('ParentModel', :
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
7
|
+
define_model('ParentModel', static: :integer,
|
8
|
+
evaluates_first: :integer,
|
9
|
+
evaluates_second: :integer,
|
10
|
+
evaluates_third: :integer)
|
11
11
|
|
12
12
|
FactoryGirl.define do
|
13
13
|
factory :parent_model do
|
@@ -20,7 +20,7 @@ describe "a generated attributes hash where order matters" do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
factory :without_parent, :
|
23
|
+
factory :without_parent, class: ParentModel do
|
24
24
|
evaluates_first { static }
|
25
25
|
evaluates_second { evaluates_first }
|
26
26
|
evaluates_third { evaluates_second }
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "build multiple instances" do
|
4
4
|
before do
|
5
|
-
define_model('Post', :
|
5
|
+
define_model('Post', title: :string)
|
6
6
|
|
7
7
|
FactoryGirl.define do
|
8
8
|
factory(:post) do |post|
|
@@ -30,7 +30,7 @@ describe "build multiple instances" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context "with default attributes" do
|
33
|
-
subject { FactoryGirl.build_list(:post, 20, :
|
33
|
+
subject { FactoryGirl.build_list(:post, 20, title: "The Hunting of the Snark") }
|
34
34
|
|
35
35
|
it "overrides the default values" do
|
36
36
|
subject.each do |record|
|
@@ -6,7 +6,7 @@ describe "a built instance" do
|
|
6
6
|
before do
|
7
7
|
define_model('User')
|
8
8
|
|
9
|
-
define_model('Post', :
|
9
|
+
define_model('Post', user_id: :integer) do
|
10
10
|
belongs_to :user
|
11
11
|
end
|
12
12
|
|
@@ -31,13 +31,13 @@ describe "a built instance" do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe "a built instance with :
|
34
|
+
describe "a built instance with strategy: :build" do
|
35
35
|
include FactoryGirl::Syntax::Methods
|
36
36
|
|
37
37
|
before do
|
38
38
|
define_model('User')
|
39
39
|
|
40
|
-
define_model('Post', :
|
40
|
+
define_model('Post', user_id: :integer) do
|
41
41
|
belongs_to :user
|
42
42
|
end
|
43
43
|
|
@@ -45,7 +45,7 @@ describe "a built instance with :strategy => :build" do
|
|
45
45
|
factory :user
|
46
46
|
|
47
47
|
factory :post do
|
48
|
-
association(:user, :
|
48
|
+
association(:user, strategy: :build)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -66,7 +66,7 @@ describe "calling `build` with a block" do
|
|
66
66
|
include FactoryGirl::Syntax::Methods
|
67
67
|
|
68
68
|
before do
|
69
|
-
define_model('Company', :
|
69
|
+
define_model('Company', name: :string)
|
70
70
|
|
71
71
|
FactoryGirl.define do
|
72
72
|
factory :company
|
@@ -74,7 +74,7 @@ describe "calling `build` with a block" do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "passes the built instance" do
|
77
|
-
build(:company, :
|
77
|
+
build(:company, name: 'thoughtbot') do |company|
|
78
78
|
company.name.should eq('thoughtbot')
|
79
79
|
end
|
80
80
|
end
|