about summary refs log blame commit diff
path: root/test/controllers/machines_controller_test.rb
blob: 03b68e499d0bc6294f81ad0369feb35328fa181e (plain) (tree)























                                                                                                
                                     






                               

                                                                                                        
                                     









                                             
# frozen_string_literal: true

require 'test_helper'

class MachinesControllerTest < ActionDispatch::IntegrationTest
  setup do
    @machine = machines(:one)
  end

  test 'should get index' do
    get machines_url
    assert_response :success
  end

  test 'should get new' do
    get new_machine_url
    assert_response :success
  end

  test 'should create machine' do
    assert_difference('Machine.count') do
      post machines_url, params: { machine: { edition: @machine.edition, name: @machine.name } }
    end

    assert_redirected_to machines_url
  end

  test 'should show machine' do
    get machine_url(@machine)
    assert_response :success
  end

  test 'should update machine' do
    patch machine_url(@machine), params: { machine: { edition: @machine.edition, name: @machine.name } }
    assert_redirected_to machines_url
  end

  test 'should destroy machine' do
    assert_difference('Machine.count', -1) do
      delete machine_url(@machine)
    end

    assert_redirected_to machines_url
  end
end