Feature: Table index spec

This commit is contained in:
Jesse C. Fisher 2016-02-07 02:58:53 -08:00
parent f852dc3a17
commit 73edbc369c
2 changed files with 42 additions and 1 deletions

View File

@ -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

View File

@ -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