Feature: Table index spec
This commit is contained in:
parent
f852dc3a17
commit
73edbc369c
@ -1,6 +1,6 @@
|
|||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :table do
|
factory :table do
|
||||||
title "Test Table"
|
sequence(:title) { |n| "Test Table #{n}" }
|
||||||
current_game { FactoryGirl.create(:game) }
|
current_game { FactoryGirl.create(:game) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
41
spec/features/visitors/table_index_spec.rb
Normal file
41
spec/features/visitors/table_index_spec.rb
Normal 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
|
||||||
Loading…
x
Reference in New Issue
Block a user