mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
Rename translation fixtures, explicitly use problem ids
This commit is contained in:
parent
fa86abc06d
commit
d1470f391e
@ -2,11 +2,11 @@ require 'test_helper'
|
|||||||
|
|
||||||
class TranslationsControllerTest < ActionController::TestCase
|
class TranslationsControllerTest < ActionController::TestCase
|
||||||
setup do
|
setup do
|
||||||
@translation = translations(:one)
|
@translation = translations(:translation_one)
|
||||||
@update = {
|
@update = {
|
||||||
title: 'New title',
|
title: 'New title',
|
||||||
content: 'This is the new content',
|
content: 'This is the new content',
|
||||||
problem_id: Problem.first
|
problem_id: 1
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
6
test/fixtures/problems.yml
vendored
6
test/fixtures/problems.yml
vendored
@ -1,7 +1,9 @@
|
|||||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
one:
|
one:
|
||||||
Translation_id:
|
id: 1
|
||||||
|
translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_one) %>
|
||||||
|
|
||||||
two:
|
two:
|
||||||
Translation_id:
|
id: 2
|
||||||
|
translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_two) %>
|
||||||
|
|||||||
8
test/fixtures/translations.yml
vendored
8
test/fixtures/translations.yml
vendored
@ -1,11 +1,11 @@
|
|||||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
one:
|
translation_one:
|
||||||
problem: one
|
problem_id: 1
|
||||||
title: First title
|
title: First title
|
||||||
content: The content of the translation
|
content: The content of the translation
|
||||||
|
|
||||||
two:
|
translation_two:
|
||||||
problem: two
|
problem_id: 2
|
||||||
title: Second title
|
title: Second title
|
||||||
content: The content of the second translation
|
content: The content of the second translation
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class TranslationTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test "should not save translation with duplicate title" do
|
test "should not save translation with duplicate title" do
|
||||||
translation = Translation.new(
|
translation = Translation.new(
|
||||||
title: translations(:one).title,
|
title: translations(:translation_one).title,
|
||||||
content: 'This is some content'
|
content: 'This is some content'
|
||||||
)
|
)
|
||||||
assert_not translation.save
|
assert_not translation.save
|
||||||
@ -23,7 +23,7 @@ class TranslationTest < ActiveSupport::TestCase
|
|||||||
translation = Translation.new(
|
translation = Translation.new(
|
||||||
title: 'A unique title',
|
title: 'A unique title',
|
||||||
content: 'Some content',
|
content: 'Some content',
|
||||||
problem: Problem.first
|
problem_id: 1
|
||||||
)
|
)
|
||||||
assert translation.save
|
assert translation.save
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user