Skip to content
This repository
Browse code

Add the fabrication adapter to the default

adapter list
  • Loading branch information...
commit 3881add43edc8ab402ec5f929561bdece7274c4f 1 parent 3288454
David Padilla authored September 19, 2011 ianwhite committed September 19, 2011
2  lib/pickle/config.rb
@@ -11,7 +11,7 @@ def configure(&block)
11 11
     end
12 12
     
13 13
     def adapters
14  
-      @adapters ||= [:machinist, :factory_girl, :orm]
  14
+      @adapters ||= [:machinist, :factory_girl, :fabrication, :orm]
15 15
     end
16 16
     
17 17
     def adapter_classes
13  spec/pickle/config_spec.rb
@@ -6,11 +6,11 @@
6 6
   end
7 7
 
8 8
   it "#adapters should default to :machinist, :factory_girl, :orm" do
9  
-    @config.adapters.should == [:machinist, :factory_girl, :orm]
  9
+    @config.adapters.should == [:machinist, :factory_girl, :fabrication, :orm]
10 10
   end
11 11
 
12 12
   it "#adapter_classes should default to Adapter::Machinist, Adapter::FactoryGirl, Adapter::Orm" do
13  
-    @config.adapter_classes.should == [Pickle::Adapter::Machinist, Pickle::Adapter::FactoryGirl, Pickle::Adapter::Orm]
  13
+    @config.adapter_classes.should == [Pickle::Adapter::Machinist, Pickle::Adapter::FactoryGirl, Pickle::Adapter::Fabrication, Pickle::Adapter::Orm]
14 14
   end
15 15
 
16 16
   describe "setting adapters to [:machinist, SomeAdapter]" do
@@ -29,6 +29,7 @@ class SomeAdapter; end
29 29
     it "should call adaptor.factories for each adaptor" do
30 30
       Pickle::Adapter::Machinist.should_receive(:factories).and_return([])
31 31
       Pickle::Adapter::FactoryGirl.should_receive(:factories).and_return([])
  32
+      Pickle::Adapter::Fabrication.should_receive(:factories).and_return([])
32 33
       Pickle::Adapter::Orm.should_receive(:factories).and_return([])
33 34
       @config.factories
34 35
     end
@@ -36,15 +37,17 @@ class SomeAdapter; end
36 37
     it "should aggregate factories into a hash using factory name as key" do
37 38
       Pickle::Adapter::Machinist.should_receive(:factories).and_return([@machinist = mock('machinist', :name => 'machinist')])
38 39
       Pickle::Adapter::FactoryGirl.should_receive(:factories).and_return([@factory_girl = mock('factory_girl', :name => 'factory_girl')])
  40
+      Pickle::Adapter::Fabrication.should_receive(:factories).and_return([@fabrication = mock('fabrication', :name => 'fabrication')])
39 41
       Pickle::Adapter::Orm.should_receive(:factories).and_return([@orm = mock('orm', :name => 'orm')])
40  
-      @config.factories.should == {'machinist' => @machinist, 'factory_girl' => @factory_girl, 'orm' => @orm}
  42
+      @config.factories.should == {'machinist' => @machinist, 'factory_girl' => @factory_girl, 'fabrication' => @fabrication, 'orm' => @orm}
41 43
     end
42 44
 
43 45
     it "should give preference to adaptors first in the list" do
44 46
       Pickle::Adapter::Machinist.should_receive(:factories).and_return([@machinist_one = mock('one', :name => 'one')])
45 47
       Pickle::Adapter::FactoryGirl.should_receive(:factories).and_return([@factory_girl_one = mock('one', :name => 'one'), @factory_girl_two = mock('two', :name => 'two')])
46  
-      Pickle::Adapter::Orm.should_receive(:factories).and_return([@orm_two = mock('two', :name => 'two'), @orm_three = mock('three', :name => 'three')])
47  
-      @config.factories.should == {'one' => @machinist_one, 'two' => @factory_girl_two, 'three' => @orm_three}
  48
+      Pickle::Adapter::Fabrication.should_receive(:factories).and_return([@fabrication_one = mock('one', :name => 'one'), @fabrication_three = mock('three', :name => 'three')])
  49
+      Pickle::Adapter::Orm.should_receive(:factories).and_return([@orm_two = mock('two', :name => 'two'), @orm_four = mock('four', :name => 'four')])
  50
+      @config.factories.should == {'one' => @machinist_one, 'two' => @factory_girl_two, 'three' => @fabrication_three, 'four' => @orm_four}
48 51
     end
49 52
   end
50 53
 

0 notes on commit 3881add

Please sign in to comment.
Something went wrong with that request. Please try again.