Files
old-rijeci/test/controllers/solutions_controller_test.rb
2013-12-09 03:23:49 +01:00

50 lines
1.2 KiB
Ruby

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