From e99c070c0105da7f73b25d1523f29ed3e454d5ec Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Fri, 9 Mar 2012 15:28:46 -0500 Subject: [PATCH] Remove deprecated interaction with Factory --- lib/factory_girl.rb | 1 - lib/factory_girl/deprecated.rb | 18 ----------- spec/factory_girl/deprecated_spec.rb | 45 ---------------------------- 3 files changed, 64 deletions(-) delete mode 100644 lib/factory_girl/deprecated.rb delete mode 100644 spec/factory_girl/deprecated_spec.rb diff --git a/lib/factory_girl.rb b/lib/factory_girl.rb index c98552c..bab394b 100644 --- a/lib/factory_girl.rb +++ b/lib/factory_girl.rb @@ -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 diff --git a/lib/factory_girl/deprecated.rb b/lib/factory_girl/deprecated.rb deleted file mode 100644 index d9435ca..0000000 --- a/lib/factory_girl/deprecated.rb +++ /dev/null @@ -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 diff --git a/spec/factory_girl/deprecated_spec.rb b/spec/factory_girl/deprecated_spec.rb deleted file mode 100644 index 84c519a..0000000 --- a/spec/factory_girl/deprecated_spec.rb +++ /dev/null @@ -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