hosts_controller_test.rb
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'test_helper'
class HostsControllerTest < ActionController::TestCase
setup do
@host = hosts(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:hosts)
end
test "should get new" do
get :new
assert_response :success
end
test "should create host" do
assert_difference('Host.count') do
post :create, host: { name: @host.name, password: 'secret', password_confirmation: 'secret', uri: @host.uri }
end
assert_redirected_to host_path(assigns(:host))
end
test "should show host" do
get :show, id: @host
assert_response :success
end
test "should get edit" do
get :edit, id: @host
assert_response :success
end
test "should update host" do
patch :update, id: @host, host: { name: @host.name, password: 'secret', password_confirmation: 'secret', uri: @host.uri }
assert_redirected_to host_path(assigns(:host))
end
test "should destroy host" do
assert_difference('Host.count', -1) do
delete :destroy, id: @host
end
assert_redirected_to hosts_path
end
end