]> git.openstreetmap.org Git - rails.git/commitdiff
Add factories for relations, relation_members, ways and way_nodes
authorAndy Allan <git@gravitystorm.co.uk>
Fri, 31 Mar 2017 09:40:49 +0000 (10:40 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Fri, 31 Mar 2017 09:40:49 +0000 (10:40 +0100)
test/factories/relation.rb [new file with mode: 0644]
test/factories/relation_member.rb [new file with mode: 0644]
test/factories/way.rb [new file with mode: 0644]
test/factories/way_node.rb [new file with mode: 0644]

diff --git a/test/factories/relation.rb b/test/factories/relation.rb
new file mode 100644 (file)
index 0000000..f53245c
--- /dev/null
@@ -0,0 +1,9 @@
+FactoryGirl.define do
+  factory :relation do
+    timestamp Time.now
+    visible true
+    version 1
+
+    changeset
+  end
+end
diff --git a/test/factories/relation_member.rb b/test/factories/relation_member.rb
new file mode 100644 (file)
index 0000000..b3f69e3
--- /dev/null
@@ -0,0 +1,9 @@
+FactoryGirl.define do
+  factory :relation_member do
+    member_role ""
+
+    relation
+    # Default to creating nodes, but could be ways or relations as members
+    association :member, :factory => :node
+  end
+end
diff --git a/test/factories/way.rb b/test/factories/way.rb
new file mode 100644 (file)
index 0000000..f5d9ab0
--- /dev/null
@@ -0,0 +1,9 @@
+FactoryGirl.define do
+  factory :way do
+    timestamp Time.now
+    visible true
+    version 1
+
+    changeset
+  end
+end
diff --git a/test/factories/way_node.rb b/test/factories/way_node.rb
new file mode 100644 (file)
index 0000000..203c055
--- /dev/null
@@ -0,0 +1,8 @@
+FactoryGirl.define do
+  factory :way_node do
+    sequence_id 1
+
+    way
+    node
+  end
+end