Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
AS::Deprecation prefixes messages with 'DEPRECATION WARNING: ' already
  • Loading branch information
joshuaclayton committed Mar 27, 2012
1 parent bca13f1 commit 28e3c25
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/factory_girl/syntax/vintage.rb
Expand Up @@ -23,7 +23,7 @@ module ::Factory
# 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)
Expand All @@ -46,7 +46,7 @@ def self.define(name, options = {})
#
# 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

Expand All @@ -59,7 +59,7 @@ def self.sequence(name, start_value = 1, &block)
# 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

Expand Down Expand Up @@ -88,31 +88,31 @@ def self.next(name)
# # 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
Expand All @@ -122,7 +122,7 @@ def self.stub(name, overrides = {})
# 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
Expand Down

0 comments on commit 28e3c25

Please sign in to comment.