]> git.openstreetmap.org Git - rails.git/blobdiff - test/factories/node.rb
Add a with_history trait for node factories, to automatically create corresponding...
[rails.git] / test / factories / node.rb
index 85eded4054ba42bebe350bae2186b413ed7224d0..8daadd35ad074258da98c6c2050cabf7ce2ed0bb 100644 (file)
@@ -8,5 +8,13 @@ FactoryGirl.define do
     visible true
     timestamp Time.now
     version 1
+
+    trait :with_history do
+      after(:create) do |node, _evaluator|
+        (1..node.version).each do |n|
+          create(:old_node, :node_id => node.id, :version => n)
+        end
+      end
+    end
   end
 end