|
1 | 1 | require 'rails_helper' |
2 | 2 |
|
3 | 3 | RSpec.feature "Games", type: :feature, js: true do |
4 | | - scenario 'Visiting the game' do |
5 | | - visit '/' |
6 | | - expect(page).to have_content 'Welcome to the Game' |
| 4 | + scenario 'Playing the game' do |
| 5 | + When 'a user starts the game' do |
| 6 | + visit '/' |
| 7 | + expect(page).to have_content 'Welcome to the Game' |
| 8 | + page.find('[data-start-button]').click |
| 9 | + end |
7 | 10 |
|
8 | | - page.find('[data-start-button]').click |
9 | | - expect(page).to have_content 'This is round 1' |
10 | | - expect(page).to have_selector('img') |
11 | | - expect(page).to have_selector('textarea') |
12 | | - page.find("textarea").fill_in(with: "Michael") |
13 | | - expect(page).to_not have_content "CORRECT" |
14 | | - expect(page).to_not have_content "NEXT" |
15 | | - page.find("textarea").fill_in(with: "Matt") |
16 | | - expect(page).to have_content "CORRECT" |
17 | | - expect(page).to have_content('NEXT') |
18 | | - page.find("[data-test-next]").click |
19 | | - expect(page).to have_content 'This is round 2' |
20 | | - expect(page.find("textarea").value).to eq "" |
| 11 | + Then 'the game commences' do |
| 12 | + expect(page).to have_content 'This is round 1' |
| 13 | + expect(page).to have_selector('img') |
| 14 | + expect(page).to have_selector('textarea') |
| 15 | + page.find("textarea").fill_in(with: "Michael") |
| 16 | + expect(page).to_not have_content "CORRECT" |
| 17 | + expect(page).to_not have_content "NEXT" |
| 18 | + page.find("textarea").fill_in(with: "Matt") |
| 19 | + expect(page).to have_content "CORRECT" |
| 20 | + expect(page).to have_content('NEXT') |
| 21 | + page.find("[data-test-next]").click |
| 22 | + expect(page).to have_content 'This is round 2' |
| 23 | + expect(page.find("textarea").value).to eq "" |
| 24 | + end |
21 | 25 | end |
22 | 26 |
|
23 | 27 | context 'Guess name given data for Keith' do |
|
0 commit comments