mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-26 18:18:51 +01:00
Add check whether problem has a translation
This commit is contained in:
@@ -11,4 +11,9 @@ class ProblemsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get untranslated problem" do
|
||||
get :show, id: 3
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
4
test/fixtures/problems.yml
vendored
4
test/fixtures/problems.yml
vendored
@@ -7,3 +7,7 @@ one:
|
||||
two:
|
||||
id: 2
|
||||
translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_two) %>
|
||||
|
||||
three:
|
||||
id: 3
|
||||
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProblemTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test "should save correct problem" do
|
||||
problem = Problem.new
|
||||
assert problem.save
|
||||
end
|
||||
|
||||
test "is_translated? should return false for missing translation" do
|
||||
assert_not problems(:three).is_translated?
|
||||
end
|
||||
|
||||
test "is_translated? should return true for existing translation" do
|
||||
assert problems(:one).is_translated?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user