about summary refs log tree commit diff
path: root/test/system/players_test.rb
blob: 4ea97519f072d95f3485eafef1693cfaa03a896e (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
43
44
# frozen_string_literal: true

require 'application_system_test_case'

class PlayersTest < ApplicationSystemTestCase
  setup do
    @player = players(:one)
  end

  test 'visiting the index' do
    visit players_url
    assert_selector 'h1', text: 'Players'
  end

  test 'should create player' do
    visit players_url
    click_on 'Add a player'

    fill_in 'Name', with: @player.name
    check 'Paid' if @player.paid
    fill_in 'Strikes', with: @player.strikes
    click_on 'Create Player'

    assert_text "Added #{@player.name}."
  end

  test 'should update Player' do
    visit player_url(@player)

    fill_in 'Name', with: @player.name
    check 'Paid' if @player.paid
    fill_in 'Strikes', with: @player.strikes
    click_on 'Update Player'

    assert_text "Updated #{@player.name}."
  end

  test 'should destroy Player' do
    visit player_url(@player)
    click_on "Delete #{@player.name}", match: :first

    assert_text 'Player was successfully removed'
  end
end