lxd_hosts_controller_test.rb
1.19 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 LxdHostsControllerTest < ActionController::TestCase
setup do
@lxd_host = lxd_hosts(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:lxd_hosts)
end
test "should get new" do
get :new
assert_response :success
end
test "should create lxd_host" do
assert_difference('LxdHost.count') do
post :create, lxd_host: { name: @lxd_host.name, password: 'secret', password_confirmation: 'secret', uri: @lxd_host.uri }
end
assert_redirected_to lxd_host_path(assigns(:lxd_host))
end
test "should show lxd_host" do
get :show, id: @lxd_host
assert_response :success
end
test "should get edit" do
get :edit, id: @lxd_host
assert_response :success
end
test "should update lxd_host" do
patch :update, id: @lxd_host, lxd_host: { name: @lxd_host.name, password: 'secret', password_confirmation: 'secret', uri: @lxd_host.uri }
assert_redirected_to lxd_host_path(assigns(:lxd_host))
end
test "should destroy lxd_host" do
assert_difference('LxdHost.count', -1) do
delete :destroy, id: @lxd_host
end
assert_redirected_to lxd_hosts_path
end
end