about summary refs log tree commit diff
path: root/test/system/machines_test.rb
blob: 43c1949f64d53062f28ff91ff6f7b5fad78bbe57 (plain) (blame)
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
# 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: 'Pins'
  end

  test 'should create machine' do
    visit machines_url
    click_on 'Add a pin'

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

    assert_text "Added #{@machine.name} #{@machine.edition}."
  end

  test 'should update Machine' do
    visit machine_url(@machine)

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

    assert_text "Updated #{@machine.name} #{@machine.edition}."
  end

  test 'should destroy Machine' do
    visit machine_url(@machine)
    click_on "Delete #{@machine.name}", match: :first

    assert_text 'Machine was successfully removed'
  end
end