Permalink
Browse files

Remove deprecated interaction with Factory

  • Loading branch information...
1 parent 037c39f commit e99c070c0105da7f73b25d1523f29ed3e454d5ec @joshuaclayton joshuaclayton committed Mar 9, 2012
Showing with 0 additions and 64 deletions.
  1. +0 −1 lib/factory_girl.rb
  2. +0 −18 lib/factory_girl/deprecated.rb
  3. +0 −45 spec/factory_girl/deprecated_spec.rb
View
@@ -24,7 +24,6 @@
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
@@ -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
@@ -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

0 comments on commit e99c070

Please sign in to comment.