Merge remote-tracking branch 'openstreetmap/pull/1352'
authorTom Hughes <tom@compton.nu>
Sun, 30 Oct 2016 16:59:20 +0000 (16:59 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 30 Oct 2016 16:59:20 +0000 (16:59 +0000)
.rubocop_todo.yml
test/controllers/changeset_controller_test.rb
test/factories/changeset_tags.rb [new file with mode: 0644]
test/fixtures/changeset_tags.yml [deleted file]
test/models/changeset_tag_test.rb
test/test_helper.rb

index 83d561ef1f9a16827a9f652b9405b5f612976f3a..f1e93f25bfb4cca9988b86bdde67827752574757 100644 (file)
@@ -64,7 +64,7 @@ Metrics/BlockNesting:
 # Offense count: 62
 # Configuration parameters: CountComments.
 Metrics/ClassLength:
-  Max: 1658
+  Max: 1659
 
 # Offense count: 69
 Metrics/CyclomaticComplexity:
index e77083f2d0a169767c50ebc0ca3f675375a8cd74..efdf22e54f8b25ad7d2c5613098054dc342fdc26 100644 (file)
@@ -1648,6 +1648,7 @@ EOF
 
     ## Now try with the public user
     changeset = changesets(:public_user_first_change)
+    create(:changeset_tag, :changeset => changeset)
     new_changeset = changeset.to_xml
     new_tag = XML::Node.new "tag"
     new_tag["k"] = "tagtesting"
diff --git a/test/factories/changeset_tags.rb b/test/factories/changeset_tags.rb
new file mode 100644 (file)
index 0000000..fa728f0
--- /dev/null
@@ -0,0 +1,9 @@
+FactoryGirl.define do
+  factory :changeset_tag do
+    sequence(:k) { |n| "Key #{n}" }
+    sequence(:v) { |n| "Value #{n}" }
+
+    # Fixme requires changeset factory
+    changeset_id 1
+  end
+end
diff --git a/test/fixtures/changeset_tags.yml b/test/fixtures/changeset_tags.yml
deleted file mode 100644 (file)
index ab5968b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-changeset_1_tag_1: 
-  changeset_id: 1
-  k: created_by
-  v: test suite yml
-  
-changeset_2_tag_1: 
-  changeset_id: 2
-  k: created_by
-  v: test suite yml 2
index e62808b6eb38ef7ea1ea0283bb886182e54721b9..90a8518b431bf1befe77dae90d260f9fe483e150 100644 (file)
@@ -3,10 +3,6 @@ require "test_helper"
 class ChangesetTagTest < ActiveSupport::TestCase
   api_fixtures
 
-  def test_changeset_tag_count
-    assert_equal 2, ChangesetTag.count
-  end
-
   def test_length_key_valid
     key = "k"
     (0..255).each do |i|
@@ -58,10 +54,11 @@ class ChangesetTagTest < ActiveSupport::TestCase
   end
 
   def test_uniqueness
+    existing = create(:changeset_tag)
     tag = ChangesetTag.new
-    tag.changeset_id = changeset_tags(:changeset_1_tag_1).changeset_id
-    tag.k = changeset_tags(:changeset_1_tag_1).k
-    tag.v = changeset_tags(:changeset_1_tag_1).v
+    tag.changeset_id = existing.changeset_id
+    tag.k = existing.k
+    tag.v = existing.v
     assert tag.new_record?
     assert !tag.valid?
     assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
index 0cf7c4afba2037bff098d1613079b9c26a7a97ec..95b1df307fec59d3e5876470734ba4cf2a4cb30b 100644 (file)
@@ -14,7 +14,7 @@ module ActiveSupport
     def self.api_fixtures
       # print "setting up the api_fixtures"
       fixtures :users, :user_roles
-      fixtures :changesets, :changeset_tags
+      fixtures :changesets
 
       fixtures :current_nodes, :nodes
       set_fixture_class :current_nodes => Node