thirteen-tien-len/spec/features/tables/table_index_spec.rb
2021-11-08 21:49:31 -08:00

42 lines
1.1 KiB
Ruby

# 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' 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' do
@user = FactoryGirl.create :user
signin(@user.email,'password')
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