Skip to content
This repository
Browse code

Revert "Deprecate attributes_for and build_stubbed"

This reverts commit a883315.
  • Loading branch information...
commit 2d6adfd009f51fa8ed6c57434dca93e8ff5b05ff 1 parent 5780364
Joshua Clayton joshuaclayton authored
10 lib/factory_girl/syntax/methods.rb
@@ -5,10 +5,6 @@ module Methods
5 5 # can be individually overridden by passing in a Hash of attribute => value
6 6 # pairs.
7 7 #
8   - # DEPRECATED
9   - #
10   - # Use build or create instead, calling attributes on the result
11   - #
12 8 # Arguments:
13 9 # * name: +Symbol+ or +String+
14 10 # The name of the factory that should be used.
@@ -22,7 +18,6 @@ module Methods
22 18 # A set of attributes that can be used to build an instance of the class
23 19 # this factory generates.
24 20 def attributes_for(name, *traits_and_overrides, &block)
25   - $stderr.puts "DEPRECATION WARNING: FactoryGirl.attributes_for is deprecated; use FactoryGirl.build or FactoryGirl.create and call #attributes on the result instead."
26 21 run_factory_girl_proxy(name, traits_and_overrides, Proxy::AttributesFor, &block)
27 22 end
28 23
@@ -72,10 +67,6 @@ def create(name, *traits_and_overrides, &block)
72 67 # stubbed out. Attributes can be individually overridden by passing in a Hash
73 68 # of attribute => value pairs.
74 69 #
75   - # DEPRECATED
76   - #
77   - # Use build instead
78   - #
79 70 # Arguments:
80 71 # * name: +Symbol+ or +String+
81 72 # The name of the factory that should be used.
@@ -88,7 +79,6 @@ def create(name, *traits_and_overrides, &block)
88 79 # Returns: +Object+
89 80 # An object with generated attributes stubbed out.
90 81 def build_stubbed(name, *traits_and_overrides, &block)
91   - $stderr.puts "DEPRECATION WARNING: FactoryGirl.build_stubbed is deprecated; use FactoryGirl.build instead."
92 82 run_factory_girl_proxy(name, traits_and_overrides, Proxy::Stub, &block)
93 83 end
94 84
8 lib/factory_girl/syntax/vintage.rb
@@ -110,10 +110,6 @@ def self.alias(pattern, replace)
110 110 end
111 111
112 112 # Alias for FactoryGirl.attributes_for
113   - #
114   - # DEPRECATED
115   - #
116   - # Use build or create instead, calling attributes on the result
117 113 def self.attributes_for(name, overrides = {})
118 114 FactoryGirl.attributes_for(name, overrides)
119 115 end
@@ -129,10 +125,6 @@ def self.create(name, overrides = {})
129 125 end
130 126
131 127 # Alias for FactoryGirl.build_stubbed.
132   - #
133   - # DEPRECATED
134   - #
135   - # Use build instead
136 128 def self.stub(name, overrides = {})
137 129 FactoryGirl.build_stubbed(name, overrides)
138 130 end

1 comment on commit 2d6adfd

Joshua Ballanco

Thank you thank you thank you!

Just for future reference: In addition to the complaint regarding #attributes_for and nil values (here), replacing #build_stubbed with #build was unsatisfactory because the later does not set the "id" attribute, so resulting objects are useless for url_for helpers.

Please sign in to comment.
Something went wrong with that request. Please try again.