about summary refs log blame commit diff
path: root/test/system/machines_test.rb
blob: 552b188044f9f15e1234eab0770f77e535a5fef9 (plain) (tree)












































                                                    
# frozen_string_literal: true

require 'application_system_test_case'

class MachinesTest < ApplicationSystemTestCase
  setup do
    @machine = machines(:one)
  end

  test 'visiting the index' do
    visit machines_url
    assert_selector 'h1', text: 'Machines'
  end

  test 'should create machine' do
    visit machines_url
    click_on 'New machine'

    fill_in 'Edition', with: @machine.edition
    fill_in 'Name', with: @machine.name
    click_on 'Create Machine'

    assert_text 'Machine was successfully created'
    click_on 'Back'
  end

  test 'should update Machine' do
    visit machine_url(@machine)
    click_on 'Edit this machine', match: :first

    fill_in 'Edition', with: @machine.edition
    fill_in 'Name', with: @machine.name
    click_on 'Update Machine'

    assert_text 'Machine was successfully updated'
    click_on 'Back'
  end

  test 'should destroy Machine' do
    visit machine_url(@machine)
    click_on 'Destroy this machine', match: :first

    assert_text 'Machine was successfully destroyed'
  end
end