lxd_hosts_controller_test.rb 1.19 KB
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