left4me/rails/test/controllers/commands_controller_test.rb
mwiegand 5ab99c7779
wip
2022-11-27 17:32:21 +01:00

48 lines
1.1 KiB
Ruby

require "test_helper"
class CommandsControllerTest < ActionDispatch::IntegrationTest
setup do
@command = commands(:one)
end
test "should get index" do
get commands_url
assert_response :success
end
test "should get new" do
get new_command_url
assert_response :success
end
test "should create command" do
assert_difference("Command.count") do
post commands_url, params: { command: { datatype_id: @command.datatype_id, name: @command.name } }
end
assert_redirected_to command_url(Command.last)
end
test "should show command" do
get command_url(@command)
assert_response :success
end
test "should get edit" do
get edit_command_url(@command)
assert_response :success
end
test "should update command" do
patch command_url(@command), params: { command: { datatype_id: @command.datatype_id, name: @command.name } }
assert_redirected_to command_url(@command)
end
test "should destroy command" do
assert_difference("Command.count", -1) do
delete command_url(@command)
end
assert_redirected_to commands_url
end
end