From 73edbc369c8254ba5459e3150a38acd06c2c593b Mon Sep 17 00:00:00 2001 From: "Jesse C. Fisher" Date: Sun, 7 Feb 2016 02:58:53 -0800 Subject: [PATCH] Feature: Table index spec --- spec/factories/tables.rb | 2 +- spec/features/visitors/table_index_spec.rb | 41 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 spec/features/visitors/table_index_spec.rb diff --git a/spec/factories/tables.rb b/spec/factories/tables.rb index 1a757675..c627998d 100644 --- a/spec/factories/tables.rb +++ b/spec/factories/tables.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :table do - title "Test Table" + sequence(:title) { |n| "Test Table #{n}" } current_game { FactoryGirl.create(:game) } end diff --git a/spec/features/visitors/table_index_spec.rb b/spec/features/visitors/table_index_spec.rb new file mode 100644 index 00000000..f706f56c --- /dev/null +++ b/spec/features/visitors/table_index_spec.rb @@ -0,0 +1,41 @@ +# Feature: Browse table index +# As a visitor +# I want to browse the table index +# So I can find a table to join +feature 'Table index', :devise do + context 'As a visitor' do + # Scenario: Visitor can browse table index + # Given I am not signed in + # When I click browse tables + # Then I see an index of tables + scenario 'I can see all the tables', js: true do + 5.times { FactoryGirl.create :table } + visit root_path + click_link 'Browse Tables' + Table.all.each do |table| + expect(page).to have_content "Sign in" + expect(page).to have_content table.title + end + end + end + + context 'As a user' do + # Scenario: User can browse table index + # Given I am signed in + # When I click browse tables + # Then I see an index of tables + scenario 'I can see all the tables', js: true do + @user = FactoryGirl.create :user + signin(@user.email,'please123') + + 5.times { FactoryGirl.create :table } + visit root_path + click_link 'Browse Tables' + Table.all.each do |table| + expect(page).to have_content "Sign out" + expect(page).to have_content table.title + end + end + end + +end