mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-27 02:28:50 +01:00
Show author names in problem and translation views
This commit is contained in:
@@ -22,7 +22,7 @@ class TranslationsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create translation" do
|
||||
test "should create translation anonymously" do
|
||||
assert_difference('Translation.count') do
|
||||
post problem_translations_url(problem_id: 1, translation: @update)
|
||||
end
|
||||
@@ -30,6 +30,16 @@ class TranslationsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_redirected_to problem_path(id: 1)
|
||||
end
|
||||
|
||||
test "should create translation with user" do
|
||||
login_translator
|
||||
assert_difference('Translation.count') do
|
||||
post problem_translations_url(problem_id: 1, translation: @update)
|
||||
end
|
||||
|
||||
assert_redirected_to problem_path(id: 1)
|
||||
assert_equal users(:translator), Translation.last.author
|
||||
end
|
||||
|
||||
test "should not create incorrect translation" do
|
||||
assert_no_difference('Translation.count') do
|
||||
post problem_translations_url(problem_id: 1, translation: @incorrect)
|
||||
|
||||
Reference in New Issue
Block a user