about summary refs log tree commit diff
path: root/test/system/players_test.rb
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2022-01-15 12:10:26 -0500
committerBen Harris <ben@tilde.team>2022-01-15 12:10:26 -0500
commit2c8c227493509175fcdbcba3e6a85f8b954a169e (patch)
tree56c95cb471004fef1bfa4c99e93fdec1716e3840 /test/system/players_test.rb
init
Diffstat (limited to 'test/system/players_test.rb')
-rw-r--r--test/system/players_test.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/system/players_test.rb b/test/system/players_test.rb
new file mode 100644
index 0000000..b00910c
--- /dev/null
+++ b/test/system/players_test.rb
@@ -0,0 +1,47 @@
+# 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 'New player'
+
+    fill_in 'Name', with: @player.name
+    check 'Paid' if @player.paid
+    fill_in 'Strikes', with: @player.strikes
+    click_on 'Create Player'
+
+    assert_text 'Player was successfully created'
+    click_on 'Back'
+  end
+
+  test 'should update Player' do
+    visit player_url(@player)
+    click_on 'Edit this player', match: :first
+
+    fill_in 'Name', with: @player.name
+    check 'Paid' if @player.paid
+    fill_in 'Strikes', with: @player.strikes
+    click_on 'Update Player'
+
+    assert_text 'Player was successfully updated'
+    click_on 'Back'
+  end
+
+  test 'should destroy Player' do
+    visit player_url(@player)
+    click_on 'Destroy this player', match: :first
+
+    assert_text 'Player was successfully destroyed'
+  end
+end