Refactor changeset tags model test to remove dependency on fixtures.
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 31 May 2017 15:49:17 +0000 (16:49 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 31 May 2017 15:49:17 +0000 (16:49 +0100)
test/models/changeset_tag_test.rb

index 90a8518b431bf1befe77dae90d260f9fe483e150..030614a1eeebe3e4e63e4e004b2524f5e6666811 100644 (file)
@@ -1,13 +1,13 @@
 require "test_helper"
 
 class ChangesetTagTest < ActiveSupport::TestCase
-  api_fixtures
-
   def test_length_key_valid
+    changeset = create(:changeset)
+
     key = "k"
     (0..255).each do |i|
       tag = ChangesetTag.new
-      tag.changeset_id = 1
+      tag.changeset_id = changeset.id
       tag.k = key * i
       tag.v = "v"
       assert tag.valid?
@@ -15,10 +15,12 @@ class ChangesetTagTest < ActiveSupport::TestCase
   end
 
   def test_length_value_valid
+    changeset = create(:changeset)
+
     val = "v"
     (0..255).each do |i|
       tag = ChangesetTag.new
-      tag.changeset_id = 1
+      tag.changeset_id = changeset.id
       tag.k = "k"
       tag.v = val * i
       assert tag.valid?