diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb index 6bbc3fb..20a60d7 100644 --- a/app/controllers/problems_controller.rb +++ b/app/controllers/problems_controller.rb @@ -17,9 +17,4 @@ class ProblemsController < ApplicationController def set_problem @problem = Problem.find(params[:id]) end - - # Never trust parameters from the scary internet, only allow the white list through. - def problem_params - params.require(:problem) - end end diff --git a/test/controllers/translations_controller_test.rb b/test/controllers/translations_controller_test.rb index f30faaa..4fc01d0 100644 --- a/test/controllers/translations_controller_test.rb +++ b/test/controllers/translations_controller_test.rb @@ -9,6 +9,10 @@ class TranslationsControllerTest < ActionController::TestCase title: 'New title', content: 'This is the new content', } + @incorrect = { + title: '', + content: '' + } @admin = admins(:admin) end @@ -32,6 +36,12 @@ class TranslationsControllerTest < ActionController::TestCase assert_redirected_to problem_path(id: 1) end + test "should not create incorrect translation" do + assert_no_difference('Translation.count') do + post :create, problem_id: 1, translation: @incorrect + end + end + test "should show translation" do sign_in @admin get :show, id: @translation