1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

AS::Deprecation prefixes messages with 'DEPRECATION WARNING: ' already

This commit is contained in:
Joshua Clayton 2012-03-27 08:58:26 -04:00
parent bca13f1165
commit 28e3c25618

View file

@ -23,7 +23,7 @@ module FactoryGirl
# Yields: +Factory+
# The newly created factory.
def self.define(name, options = {})
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.define is deprecated; use the FactoryGirl.define block syntax to declare your factory.", caller
ActiveSupport::Deprecation.warn "Factory.define is deprecated; use the FactoryGirl.define block syntax to declare your factory.", caller
factory = FactoryGirl::Factory.new(name, options)
proxy = FactoryGirl::DefinitionProxy.new(factory)
yield(proxy)
@ -46,7 +46,7 @@ module FactoryGirl
#
# Factory.sequence(:email) {|n| "somebody_#{n}@example.com" }
def self.sequence(name, start_value = 1, &block)
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.sequence is deprecated; use the FactoryGirl.define block syntax to declare your sequence.", caller
ActiveSupport::Deprecation.warn "Factory.sequence is deprecated; use the FactoryGirl.define block syntax to declare your sequence.", caller
FactoryGirl.register_sequence(Sequence.new(name, start_value, &block))
end
@ -59,7 +59,7 @@ module FactoryGirl
# Returns:
# The next value in the sequence. (Object)
def self.next(name)
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.next is deprecated; use FactoryGirl.generate instead.", caller
ActiveSupport::Deprecation.warn "Factory.next is deprecated; use FactoryGirl.generate instead.", caller
FactoryGirl.generate(name)
end
@ -88,31 +88,31 @@ module FactoryGirl
# # will be used instead.
# Factory(:post, user_id: 1)
def self.alias(pattern, replace)
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.alias is deprecated; use FactoryGirl.aliases << [pattern, replace] instead.", caller
ActiveSupport::Deprecation.warn "Factory.alias is deprecated; use FactoryGirl.aliases << [pattern, replace] instead.", caller
FactoryGirl.aliases << [pattern, replace]
end
# Alias for FactoryGirl.attributes_for
def self.attributes_for(name, overrides = {})
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.attributes_for is deprecated; use FactoryGirl.attributes_for instead.", caller
ActiveSupport::Deprecation.warn "Factory.attributes_for is deprecated; use FactoryGirl.attributes_for instead.", caller
FactoryGirl.attributes_for(name, overrides)
end
# Alias for FactoryGirl.build
def self.build(name, overrides = {})
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.build is deprecated; use FactoryGirl.build instead.", caller
ActiveSupport::Deprecation.warn "Factory.build is deprecated; use FactoryGirl.build instead.", caller
FactoryGirl.build(name, overrides)
end
# Alias for FactoryGirl.create
def self.create(name, overrides = {})
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.create is deprecated; use FactoryGirl.create instead.", caller
ActiveSupport::Deprecation.warn "Factory.create is deprecated; use FactoryGirl.create instead.", caller
FactoryGirl.create(name, overrides)
end
# Alias for FactoryGirl.build_stubbed.
def self.stub(name, overrides = {})
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory.stub is deprecated; use FactoryGirl.build_stubbed instead.", caller
ActiveSupport::Deprecation.warn "Factory.stub is deprecated; use FactoryGirl.build_stubbed instead.", caller
FactoryGirl.build_stubbed(name, overrides)
end
end
@ -122,7 +122,7 @@ module FactoryGirl
# Example:
# Factory(:user, name: 'Joe')
def Factory(name, attrs = {})
ActiveSupport::Deprecation.warn "DEPRECATION WARNING: Factory(:name) is deprecated; use FactoryGirl.create(:name) instead.", caller
ActiveSupport::Deprecation.warn "Factory(:name) is deprecated; use FactoryGirl.create(:name) instead.", caller
FactoryGirl.create(name, attrs)
end
end