public
Fork of technoweenie/model_stubbing
Description: Rails 1.2.x compatible version - Replacement for ActiveRecord fixtures using an extremely flexible ruby-based approach.
Clone URL: git://github.com/jacqui/model_stubbing.git
dup #ordered_models when duping definition, add fix for mixing model-stubs 
and AR fixtures in rails

git-svn-id: http://ar-code.svn.engineyard.com/plugins/model_stubbing@94 
d98f8484-0aa7-43af-80ea-302c351499d6
rick (author)
Fri Dec 07 18:49:54 -0800 2007
commit  1d569f9326ca9a41d1393d3053db239383a41ecd
tree    6bd820d21a1bf2c4610f846bbf8871dd9c7c74fc
parent  485fe44f5cc364dda25bbf671297695e03431f0d
...
37
38
39
 
40
41
42
...
37
38
39
40
41
42
43
0
@@ -37,6 +37,7 @@ module ModelStubbing
0
     
0
     def dup
0
       copy = self.class.new
0
+ copy.ordered_models.push *@ordered_models
0
       copy.current_time = @current_time
0
       models.each do |name, model|
0
         copy.models[name] = model.dup(copy)
...
90
91
92
 
93
94
95
...
90
91
92
93
94
95
96
0
@@ -90,6 +90,7 @@ module ModelStubbing
0
     end
0
     
0
     def insert
0
+ Fixtures.cache_for_connection(connection).delete(@model_class.table_name) if defined?(Fixtures)
0
       purge
0
       @stubs.values.each &:insert
0
     end
...
67
68
69
70
 
 
 
 
 
71
72
73
...
67
68
69
 
70
71
72
73
74
75
76
77
0
@@ -67,7 +67,11 @@ describe Definition, "duping itself" do
0
   it "dups @current_time" do
0
     @defn.current_time.should == @copy.current_time
0
   end
0
-
0
+
0
+ it "transfers ordered_models" do
0
+ @copy.ordered_models.should == @defn.ordered_models
0
+ end
0
+
0
   it "dups each model" do
0
     @defn.models.each do |name, model|
0
       duped_model = @copy.models[name]

Comments

    No one has commented yet.