198 lines
4.7 KiB
Ruby
198 lines
4.7 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe "Find Session", :js => true, :type => :feature, :capybara_feature => true, :slow => true do
|
|
|
|
subject { page }
|
|
|
|
let(:user) { FactoryGirl.create(:user) }
|
|
let(:finder) { FactoryGirl.create(:user) }
|
|
|
|
before(:each) do
|
|
UserMailer.deliveries.clear
|
|
ActiveMusicSession.delete_all
|
|
SessionInfoComment.delete_all
|
|
Notification.delete_all
|
|
RsvpRequestRsvpSlot.delete_all
|
|
RsvpRequest.delete_all
|
|
RsvpSlot.delete_all
|
|
Invitation.delete_all
|
|
MusicSession.delete_all
|
|
end
|
|
|
|
describe "basic" do
|
|
|
|
before(:each) do
|
|
emulate_client
|
|
sign_in_poltergeist user
|
|
visit "/client#/findSession"
|
|
FactoryGirl.create(:friendship, :user => user, :friend => finder)
|
|
end
|
|
|
|
|
|
# when no sessions have been created:
|
|
it "shows there are no sessions" do
|
|
# verify no sessions are found
|
|
expect(page).to have_selector('#no-active-sessions')
|
|
expect(page).to have_selector('#no-scheduled-sessions')
|
|
end
|
|
|
|
it "finds another public session" do
|
|
create_join_session(user, [finder])
|
|
end
|
|
|
|
describe "listing behavior" do
|
|
|
|
describe "one slush session" do
|
|
before do
|
|
@session1 = FactoryGirl.create(:single_user_session)
|
|
end
|
|
|
|
it "find general population user" do
|
|
pending
|
|
find('#btn-refresh').trigger(:click)
|
|
sleep 1
|
|
find('div#sessions-active')
|
|
page.all('div#sessions-active .found-session').count.should == 1
|
|
end
|
|
|
|
describe "tons of slush sessions" do
|
|
before do
|
|
20.times do
|
|
FactoryGirl.create(:single_user_session)
|
|
end
|
|
end
|
|
|
|
it "find many general users" do
|
|
pending
|
|
find('#btn-refresh').trigger(:click)
|
|
sleep 1
|
|
find('div#sessions-active')
|
|
page.all('div#sessions-active .found-session').count.should == 20
|
|
|
|
# attempt to scroll down--the end of session list should show, and there should now be 21 items
|
|
# page.execute_script('jQuery("#findSession .content-body-scroller").scrollTo("100%",100)') #scroll to the bottom of the element
|
|
# find('#end-of-session-list')
|
|
# page.all('div#sessions-active .found-session').count.should == 21
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
describe "active sessions" do
|
|
it "should render session details" do
|
|
# name
|
|
|
|
# genre
|
|
|
|
# description
|
|
|
|
# notation files
|
|
|
|
# musicians in session
|
|
|
|
# approved RSVPs
|
|
|
|
# open slots
|
|
|
|
# latency tag
|
|
|
|
# chat language
|
|
|
|
# musician access
|
|
|
|
# fan access
|
|
|
|
# legal policy
|
|
end
|
|
|
|
it "should allow user to join if invited" do
|
|
end
|
|
|
|
it "should allow user to join if musician_access is true" do
|
|
end
|
|
|
|
it "should allow user to join if invited and musician_access is false" do
|
|
end
|
|
end
|
|
|
|
describe "scheduled sessions" do
|
|
it "should render session details" do
|
|
# name
|
|
|
|
# genre
|
|
|
|
# description
|
|
|
|
# notation files
|
|
|
|
# approved RSVPs
|
|
|
|
# open slots
|
|
|
|
# latency tag
|
|
|
|
# chat language
|
|
|
|
# musician access
|
|
|
|
# fan access
|
|
|
|
# legal policy
|
|
end
|
|
|
|
it "should allow user to RSVP if invited" do
|
|
end
|
|
|
|
it "should allow user to RSVP if open_rsvps is true" do
|
|
end
|
|
|
|
it "should allow user to RSVP if invited and open_rsvps is false" do
|
|
end
|
|
end
|
|
|
|
describe "rsvp behavior" do
|
|
before(:each) do
|
|
stub_const("APP_CONFIG", web_config)
|
|
end
|
|
|
|
it "handles is_unstructured_rsvp sessions correctly" do
|
|
|
|
# create an unstructured session
|
|
music_session = FactoryGirl.create(:music_session, creator: user, is_unstructured_rsvp: true)
|
|
|
|
fast_signin(finder, Nav.find_session)
|
|
|
|
# verify it says the right thing in the 'Still Needed' section
|
|
find("#sessions-scheduled tr.found-session div.instruments", text: 'Any Instrument (Any Skill Level)')
|
|
|
|
# bring up the RSVP dialog
|
|
find('.rsvp-link').trigger(:click)
|
|
|
|
# select the only option (Any Instrument)
|
|
find('.rsvp-instruments input[value="unstructured"]').trigger(:click)
|
|
|
|
# submit the RSVP
|
|
find('#btnSubmitRsvp').trigger(:click)
|
|
|
|
# TODO: verify that the UI works - after VRFS-1892
|
|
end
|
|
|
|
it "RSVP text shows correctly" do
|
|
music_session = FactoryGirl.create(:music_session, creator: user, is_unstructured_rsvp: true)
|
|
|
|
fast_signin(user, Nav.find_session)
|
|
|
|
find("#sessions-scheduled .rsvp-msg span.text", text: "You have been confirmed for this session. ")
|
|
|
|
sign_out
|
|
|
|
go_to_root
|
|
|
|
fast_signin(finder, Nav.find_session)
|
|
|
|
find("#sessions-scheduled .rsvp-msg span.text", text: "You have been confirmed for this session. ")
|
|
end
|
|
end
|
|
end
|