mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
Add tests for status change
This commit is contained in:
parent
8da1323fd8
commit
0dd3092c4c
8
test/fixtures/translations.yml
vendored
8
test/fixtures/translations.yml
vendored
@ -4,8 +4,16 @@ translation_one:
|
|||||||
problem_id: 1
|
problem_id: 1
|
||||||
title: First title
|
title: First title
|
||||||
content: The content of the translation
|
content: The content of the translation
|
||||||
|
status: 1
|
||||||
|
|
||||||
translation_two:
|
translation_two:
|
||||||
problem_id: 2
|
problem_id: 2
|
||||||
title: Second title
|
title: Second title
|
||||||
content: The content of the second translation
|
content: The content of the second translation
|
||||||
|
status: 1
|
||||||
|
|
||||||
|
translation_two_alternative:
|
||||||
|
problem_id: 2
|
||||||
|
title: Second title
|
||||||
|
content: The changed content for the second problem
|
||||||
|
status: 0
|
||||||
|
|||||||
@ -14,6 +14,12 @@ class ProblemTest < ActiveSupport::TestCase
|
|||||||
assert problems(:one).is_translated?
|
assert problems(:one).is_translated?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "set_translation should modify status correctly" do
|
||||||
|
problems(:two).set_translation(translations(:translation_two_alternative))
|
||||||
|
assert translations(:translation_two).outdated?
|
||||||
|
assert translations(:translation_two_alternative).in_use?
|
||||||
|
end
|
||||||
|
|
||||||
test "should have correct original url" do
|
test "should have correct original url" do
|
||||||
assert_equal "https://projecteuler.net/problem=1", problems(:one).original_url
|
assert_equal "https://projecteuler.net/problem=1", problems(:one).original_url
|
||||||
end
|
end
|
||||||
|
|||||||
@ -36,5 +36,6 @@ class TranslationTest < ActiveSupport::TestCase
|
|||||||
problem_id: 1
|
problem_id: 1
|
||||||
)
|
)
|
||||||
assert translation.save
|
assert translation.save
|
||||||
|
assert translation.pending?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user