Skip to content

Commit

Permalink
Revert "Deprecate attributes_for and build_stubbed"
Browse files Browse the repository at this point in the history
This reverts commit a883315.
  • Loading branch information
joshuaclayton committed Jan 20, 2012
1 parent 5780364 commit 2d6adfd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
10 changes: 0 additions & 10 deletions lib/factory_girl/syntax/methods.rb
Expand Up @@ -5,10 +5,6 @@ module Methods
# can be individually overridden by passing in a Hash of attribute => value
# pairs.
#
# DEPRECATED
#
# Use build or create instead, calling attributes on the result
#
# Arguments:
# * name: +Symbol+ or +String+
# The name of the factory that should be used.
Expand All @@ -22,7 +18,6 @@ module Methods
# A set of attributes that can be used to build an instance of the class
# this factory generates.
def attributes_for(name, *traits_and_overrides, &block)
$stderr.puts "DEPRECATION WARNING: FactoryGirl.attributes_for is deprecated; use FactoryGirl.build or FactoryGirl.create and call #attributes on the result instead."
run_factory_girl_proxy(name, traits_and_overrides, Proxy::AttributesFor, &block)
end

Expand Down Expand Up @@ -72,10 +67,6 @@ def create(name, *traits_and_overrides, &block)
# stubbed out. Attributes can be individually overridden by passing in a Hash
# of attribute => value pairs.
#
# DEPRECATED
#
# Use build instead
#
# Arguments:
# * name: +Symbol+ or +String+
# The name of the factory that should be used.
Expand All @@ -88,7 +79,6 @@ def create(name, *traits_and_overrides, &block)
# Returns: +Object+
# An object with generated attributes stubbed out.
def build_stubbed(name, *traits_and_overrides, &block)
$stderr.puts "DEPRECATION WARNING: FactoryGirl.build_stubbed is deprecated; use FactoryGirl.build instead."
run_factory_girl_proxy(name, traits_and_overrides, Proxy::Stub, &block)
end

Expand Down
8 changes: 0 additions & 8 deletions lib/factory_girl/syntax/vintage.rb
Expand Up @@ -110,10 +110,6 @@ def self.alias(pattern, replace)
end

# Alias for FactoryGirl.attributes_for
#
# DEPRECATED
#
# Use build or create instead, calling attributes on the result
def self.attributes_for(name, overrides = {})
FactoryGirl.attributes_for(name, overrides)
end
Expand All @@ -129,10 +125,6 @@ def self.create(name, overrides = {})
end

# Alias for FactoryGirl.build_stubbed.
#
# DEPRECATED
#
# Use build instead
def self.stub(name, overrides = {})
FactoryGirl.build_stubbed(name, overrides)
end
Expand Down

1 comment on commit 2d6adfd

@jballanc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.