]> git.openstreetmap.org Git - rails.git/blobdiff - test/factories/way.rb
Add a way_with_nodes factory, and use it in the way_controller tests.
[rails.git] / test / factories / way.rb
index f5d9ab07100bd19d4a5ce93fa3115a1bb75ff375..89409e807aa0a1088edd3b39ca61c5c3dea903f9 100644 (file)
@@ -5,5 +5,21 @@ FactoryGirl.define do
     version 1
 
     changeset
+
+    trait :deleted do
+      visible false
+    end
+
+    factory :way_with_nodes do
+      transient do
+        nodes_count 1
+      end
+
+      after(:create) do |way, evaluator|
+        (1..evaluator.nodes_count).each do |n|
+          create(:way_node, :way => way, :sequence_id => n)
+        end
+      end
+    end
   end
 end