mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
Increase test coverage
This commit is contained in:
parent
dd37705e27
commit
f989cd64db
@ -17,9 +17,4 @@ class ProblemsController < ApplicationController
|
|||||||
def set_problem
|
def set_problem
|
||||||
@problem = Problem.find(params[:id])
|
@problem = Problem.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
|
||||||
def problem_params
|
|
||||||
params.require(:problem)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,6 +9,10 @@ class TranslationsControllerTest < ActionController::TestCase
|
|||||||
title: 'New title',
|
title: 'New title',
|
||||||
content: 'This is the new content',
|
content: 'This is the new content',
|
||||||
}
|
}
|
||||||
|
@incorrect = {
|
||||||
|
title: '',
|
||||||
|
content: ''
|
||||||
|
}
|
||||||
@admin = admins(:admin)
|
@admin = admins(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,6 +36,12 @@ class TranslationsControllerTest < ActionController::TestCase
|
|||||||
assert_redirected_to problem_path(id: 1)
|
assert_redirected_to problem_path(id: 1)
|
||||||
end
|
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
|
test "should show translation" do
|
||||||
sign_in @admin
|
sign_in @admin
|
||||||
get :show, id: @translation
|
get :show, id: @translation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user