From d1470f391ef1c3799267b8afb1f345ee1c204143 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Mon, 29 Dec 2014 15:41:56 +0100 Subject: [PATCH] Rename translation fixtures, explicitly use problem ids --- test/controllers/translations_controller_test.rb | 4 ++-- test/fixtures/problems.yml | 6 ++++-- test/fixtures/translations.yml | 8 ++++---- test/models/translation_test.rb | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/controllers/translations_controller_test.rb b/test/controllers/translations_controller_test.rb index 603d0e7..a1cbc04 100644 --- a/test/controllers/translations_controller_test.rb +++ b/test/controllers/translations_controller_test.rb @@ -2,11 +2,11 @@ require 'test_helper' class TranslationsControllerTest < ActionController::TestCase setup do - @translation = translations(:one) + @translation = translations(:translation_one) @update = { title: 'New title', content: 'This is the new content', - problem_id: Problem.first + problem_id: 1 } end diff --git a/test/fixtures/problems.yml b/test/fixtures/problems.yml index d3043bc..1914f9b 100644 --- a/test/fixtures/problems.yml +++ b/test/fixtures/problems.yml @@ -1,7 +1,9 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - Translation_id: + id: 1 + translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_one) %> two: - Translation_id: + id: 2 + translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_two) %> diff --git a/test/fixtures/translations.yml b/test/fixtures/translations.yml index 0fa0201..f8bcb86 100644 --- a/test/fixtures/translations.yml +++ b/test/fixtures/translations.yml @@ -1,11 +1,11 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -one: - problem: one +translation_one: + problem_id: 1 title: First title content: The content of the translation -two: - problem: two +translation_two: + problem_id: 2 title: Second title content: The content of the second translation diff --git a/test/models/translation_test.rb b/test/models/translation_test.rb index 34bab0a..088628e 100644 --- a/test/models/translation_test.rb +++ b/test/models/translation_test.rb @@ -13,7 +13,7 @@ class TranslationTest < ActiveSupport::TestCase test "should not save translation with duplicate title" do translation = Translation.new( - title: translations(:one).title, + title: translations(:translation_one).title, content: 'This is some content' ) assert_not translation.save @@ -23,7 +23,7 @@ class TranslationTest < ActiveSupport::TestCase translation = Translation.new( title: 'A unique title', content: 'Some content', - problem: Problem.first + problem_id: 1 ) assert translation.save end