initial commit
This commit is contained in:
49
test/controllers/solutions_controller_test.rb
Normal file
49
test/controllers/solutions_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SolutionsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@solution = solutions(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:solutions)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create solution" do
|
||||
assert_difference('Solution.count') do
|
||||
post :create, solution: { number: @solution.number, time: @solution.time, username: @solution.username }
|
||||
end
|
||||
|
||||
assert_redirected_to solution_path(assigns(:solution))
|
||||
end
|
||||
|
||||
test "should show solution" do
|
||||
get :show, id: @solution
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @solution
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update solution" do
|
||||
patch :update, id: @solution, solution: { number: @solution.number, time: @solution.time, username: @solution.username }
|
||||
assert_redirected_to solution_path(assigns(:solution))
|
||||
end
|
||||
|
||||
test "should destroy solution" do
|
||||
assert_difference('Solution.count', -1) do
|
||||
delete :destroy, id: @solution
|
||||
end
|
||||
|
||||
assert_redirected_to solutions_path
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user