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

Remove deprecated interaction with Factory

This commit is contained in:
Joshua Clayton 2012-03-09 15:28:46 -05:00
parent 037c39f151
commit e99c070c01
3 changed files with 0 additions and 64 deletions

View file

@ -24,7 +24,6 @@ require 'factory_girl/definition_proxy'
require 'factory_girl/syntax'
require 'factory_girl/find_definitions'
require 'factory_girl/reload'
require 'factory_girl/deprecated'
require 'factory_girl/version'
if defined?(Rails) && Rails::VERSION::MAJOR == 2

View file

@ -1,18 +0,0 @@
module Factory
def self.method_missing(name, *args, &block)
if FactoryGirl.respond_to?(name)
$stderr.puts "DEPRECATION WARNING: Change Factory.#{name} to FactoryGirl.#{name}"
FactoryGirl.send(name, *args, &block)
else
super(name, *args, &block)
end
end
def self.const_missing(name)
if FactoryGirl.const_defined?(name)
FactoryGirl.const_get(name)
else
super(name)
end
end
end

View file

@ -1,45 +0,0 @@
require 'spec_helper'
describe "accessing an undefined method on Factory that is defined on FactoryGirl" do
let(:method_name) { :aliases }
let(:return_value) { 'value' }
let(:args) { [1, 2, 3] }
before do
FactoryGirl.stubs(method_name => return_value)
end
subject { Factory.send(method_name, *args) }
it "prints a deprecation warning" do
$stderr.stubs(:puts)
subject
$stderr.should have_received(:puts).with(anything)
end
it "invokes that method on FactoryGirl" do
subject
FactoryGirl.should have_received(method_name).with(*args)
end
it "returns the value from the method on FactoryGirl" do
subject.should == return_value
end
end
describe "accessing an undefined method on Factory that is not defined on FactoryGirl" do
it "raises a NoMethodError" do
expect { Factory.send(:magic_beans) }.to raise_error(NoMethodError)
end
end
describe "accessing an undefined constant on Factory that is defined on FactoryGirl" do
subject { Factory::VERSION }
it { should == FactoryGirl::VERSION }
end
describe "accessing an undefined constant on Factory that is undefined on FactoryGirl" do
it "raises a NameError for Factory" do
expect { Factory::BOGUS }.to raise_error(NameError, /Factory::BOGUS/)
end
end