Show author names in problem and translation views

This commit is contained in:
pfischbeck committed 2019-02-05 12:00:25 +01:00
1 parent ddb1cfac33
commit 89a8fbba99
14 files changed
+69 -7

No files matched your search

@@ -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)
+6 -3
View File
@@ -10,6 +10,12 @@ class ActiveSupport::TestCase
fixtures :all
# Add more helper methods to be used by all tests here...
end
class ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
def login_admin
admin = users(:admin)
sign_in admin
@@ -19,10 +25,7 @@ class ActiveSupport::TestCase
translator = users(:translator)
sign_in translator
end
end
class ActionDispatch::IntegrationTest
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({
provider: :github,