VRFS-1749 session info page tests wip
This commit is contained in:
parent
de7cb2d6ab
commit
d8c39e87e4
|
|
@ -9,7 +9,8 @@
|
|||
= image_tag "#{@music_session.creator.photo_url}", alt: ""
|
||||
- else
|
||||
= image_tag "shared/avatar_generic.png", alt: ""
|
||||
= @music_session.creator.name
|
||||
.creator-name
|
||||
= @music_session.creator.name
|
||||
%br/
|
||||
%span.f12 Session Creator
|
||||
%br/
|
||||
|
|
@ -25,36 +26,36 @@
|
|||
%br/
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Date/Time:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.scheduled_start
|
||||
= @music_session.scheduled_start
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Genre:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.genre
|
||||
= @music_session.genre
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Name:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.name
|
||||
= @music_session.name
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Description:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.description
|
||||
= @music_session.description
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Notation Files:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.notations
|
||||
- @music_session.music_notations.each do |n|
|
||||
%a.gold{:href => n.file_url}= n.file_url
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Language:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.language
|
||||
= @music_session.language_description
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Access:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.access
|
||||
= @music_session.access_description
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Legal:
|
||||
.right.w75.ib.mb10
|
||||
.right.w75.ib.mb10.legal_policy
|
||||
= @music_session.legal_policy.capitalize
|
||||
agreement (
|
||||
%a.gold{:href => "#{@music_session.legal_policy_url}", :target => "_blank"} View full legal details
|
||||
|
|
@ -70,13 +71,13 @@
|
|||
%strong RSVPs
|
||||
.right.w30.ib.f11.center Your latency
|
||||
- @approved_rsvps.each_with_index do |rsvp, index|
|
||||
.clearall.left.w65.h20.ib.mb10
|
||||
.clearall.left.w65.h20.ib.mb10.rsvp-details
|
||||
.avatar-tiny{'hoveraction' => "musician", 'user-id' => rsvp.id}
|
||||
- if rsvp.photo_url.nil?
|
||||
= image_tag 'shared/avatar_generic.png', :alt => ""
|
||||
- else
|
||||
%img{:src => "#{rsvp.photo_url}"}
|
||||
.left.f11.ml10
|
||||
.left.f11.ml10.rsvp-name
|
||||
= rsvp.name
|
||||
.left.ml10
|
||||
- rsvp["instruments"].each do |i|
|
||||
|
|
@ -84,7 +85,7 @@
|
|||
|
||||
%br{:clear => "all"}/
|
||||
%br/
|
||||
.left.w65.ib
|
||||
.left.w65.ib.still-needed
|
||||
%strong Still Needed
|
||||
- if @open_slots.blank?
|
||||
.clearall.left.w65.h20.ib.mb10
|
||||
|
|
@ -100,20 +101,20 @@
|
|||
|
||||
%br{:clear => "all"}/
|
||||
%br/
|
||||
.w65.ib
|
||||
.w65.ib.invited
|
||||
%strong Invited
|
||||
%br/
|
||||
- if @pending_invitations.blank?
|
||||
None
|
||||
- @pending_invitations.each_with_index do |invite, index|
|
||||
- if index == 0
|
||||
.avatar-tiny{'hoveraction' => "musician", 'user-id' => invite.id}
|
||||
.avatar-tiny.needed{'hoveraction' => "musician", 'user-id' => invite.id}
|
||||
- unless invite.photo_url.blank?
|
||||
= image_tag "#{invite.photo_url}", alt: ""
|
||||
- else
|
||||
= image_tag "shared/avatar_generic.png", alt: ""
|
||||
- else
|
||||
.ml10.avatar-tiny
|
||||
.ml10.avatar-tiny.needed
|
||||
- unless invite.photo_url.blank?
|
||||
= image_tag "#{invite.photo_url}", alt: ""
|
||||
- else
|
||||
|
|
@ -121,7 +122,7 @@
|
|||
|
||||
- else
|
||||
.left.f20.teal
|
||||
%strong SESSION NOT FOUND
|
||||
%strong.not-found SESSION NOT FOUND
|
||||
%br/
|
||||
.clearall.left.w20.ib.mb10
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,11 @@ FactoryGirl.define do
|
|||
legal_policy 'standard'
|
||||
genre JamRuby::Genre.first
|
||||
association :creator, :factory => :user
|
||||
open_rsvps false
|
||||
|
||||
factory :recurring_music_session_weekly do
|
||||
recurring_mode 'weekly'
|
||||
end
|
||||
end
|
||||
|
||||
factory :music_session_user_history, :class => JamRuby::MusicSessionUserHistory do
|
||||
|
|
@ -468,6 +473,14 @@ FactoryGirl.define do
|
|||
message Faker::Lorem.characters(10)
|
||||
end
|
||||
end
|
||||
|
||||
factory :rsvp_slot, class: JamRuby::RsvpSlot do
|
||||
proficiency_level 'beginner'
|
||||
end
|
||||
|
||||
factory :rsvp_request, class: JamRuby::RsvpRequest do
|
||||
canceled false
|
||||
cancel_all false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -2,77 +2,241 @@ require 'spec_helper'
|
|||
|
||||
describe "Session Info", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
||||
let (:user) { FactoryGirl.create(:user) }
|
||||
|
||||
before(:all) do
|
||||
MusicSession.delete_all
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
create_session(creator: user)
|
||||
formal_leave_by(user)
|
||||
SessionInfoComment.delete_all
|
||||
Notification.delete_all
|
||||
RsvpRequestRsvpSlot.delete_all
|
||||
RsvpRequest.delete_all
|
||||
RsvpSlot.delete_all
|
||||
Invitation.delete_all
|
||||
MusicSession.delete_all
|
||||
User.delete_all
|
||||
|
||||
@rsvp_user = FactoryGirl.create(:user)
|
||||
@rsvp_user.save
|
||||
|
||||
@session_invitee = FactoryGirl.create(:user)
|
||||
@session_invitee.save
|
||||
|
||||
@non_session_invitee = FactoryGirl.create(:user)
|
||||
@non_session_invitee.save
|
||||
|
||||
@session_creator = FactoryGirl.create(:user)
|
||||
@session_creator.save
|
||||
|
||||
# session invitations require sender and receiver to be friends
|
||||
FactoryGirl.create(:friendship, :user => @session_invitee, :friend => @session_creator)
|
||||
FactoryGirl.create(:friendship, :user => @session_creator, :friend => @session_invitee)
|
||||
|
||||
FactoryGirl.create(:friendship, :user => @rsvp_user, :friend => @session_creator)
|
||||
FactoryGirl.create(:friendship, :user => @session_creator, :friend => @rsvp_user)
|
||||
|
||||
@music_session = FactoryGirl.build(:music_session, :creator => @session_creator)
|
||||
@music_session.save
|
||||
|
||||
@slot1 = FactoryGirl.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar'))
|
||||
@slot1.save
|
||||
|
||||
@slot2 = FactoryGirl.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('drums'))
|
||||
@slot2.save
|
||||
|
||||
@invitation = FactoryGirl.build(:invitation, :sender => @session_creator, :receiver => @session_invitee, :music_session => @music_session)
|
||||
@invitation.save
|
||||
|
||||
@invitation = FactoryGirl.build(:invitation, :sender => @session_creator, :receiver => @rsvp_user, :music_session => @music_session)
|
||||
@invitation.save
|
||||
|
||||
# create RSVP request
|
||||
rsvp = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id, @slot2.id], :message => "Let's Jam!"}, @rsvp_user)
|
||||
|
||||
# approve slot1
|
||||
rs1 = RsvpRequestRsvpSlot.find_by_rsvp_slot_id(@slot1.id)
|
||||
rs2 = RsvpRequestRsvpSlot.find_by_rsvp_slot_id(@slot2.id)
|
||||
RsvpRequest.update({:id => rsvp.id, :session_id => @music_session.id, :rsvp_responses => [{:request_slot_id => rs1.id, :accept => true}, {:request_slot_id => rs2.id, :accept => false}]}, @session_creator)
|
||||
|
||||
end
|
||||
|
||||
# musician_access = true, approval_required = true
|
||||
it "should allow only session invitees to view for 'XXX' option before session starts" do
|
||||
def ensure_success(options = {})
|
||||
# creator avatar
|
||||
find('div.landing-avatar')
|
||||
|
||||
# creator name
|
||||
find('div.creator-name', text: @session_creator.name)
|
||||
|
||||
# action button
|
||||
find('#btn-action') if options[:show_cta]
|
||||
|
||||
# session details
|
||||
find('div.scheduled_start')
|
||||
find('div.genre', text: @music_session.genre)
|
||||
find('div.name', text: @music_session.name)
|
||||
find('div.description', text: @music_session.description)
|
||||
find('div.notations')
|
||||
find('div.language', text: @music_session.language_description)
|
||||
find('div.access', text: @music_session.access_description)
|
||||
find('div.legal_policy', text: @music_session.legal_policy.capitalize)
|
||||
|
||||
# right sidebar - RSVPs
|
||||
find('div.rsvp-details .avatar-tiny')
|
||||
find('div.rsvp-details .rsvp-name', text: @rsvp_user.name)
|
||||
find('div.rsvp-details img.instrument-icon')
|
||||
|
||||
# right sidebar - Still Needed
|
||||
find('div.still-needed', text: @slot2.instrument.id.capitalize)
|
||||
|
||||
# right sidebar - Invited
|
||||
find('div[user-id="' + @session_invitee.id + '"]')
|
||||
|
||||
# comments
|
||||
find('#txtSessionInfoComment')
|
||||
end
|
||||
|
||||
# musician_access = false, approval_required = false
|
||||
it "should allow only RSVP approvals to view for 'Only RSVP musicians may join' option after session starts" do
|
||||
def ensure_failure
|
||||
find('div.not-found', text: "SESSION NOT FOUND")
|
||||
end
|
||||
|
||||
# musician_access = true, approval_required = false
|
||||
it "should allow anyone to view for 'at will' option after session starts" do
|
||||
describe "view" do
|
||||
|
||||
it "should render for any musician for sessions with open RSVPs before session starts" do
|
||||
|
||||
@music_session.open_rsvps = true
|
||||
@music_session.save
|
||||
|
||||
# attempt to access with musician who was invited but didn't RSVP
|
||||
sign_in_poltergeist(@session_invitee)
|
||||
url = "/sessions/#{@music_session.id}/details"
|
||||
visit url
|
||||
ensure_success({:show_cta => true})
|
||||
sign_out_poltergeist
|
||||
|
||||
|
||||
# attempt to access with musician who wasn't invited
|
||||
sign_in_poltergeist(@non_session_invitee)
|
||||
|
||||
sign_out_poltergeist
|
||||
|
||||
|
||||
# attempt to access with session creator
|
||||
sign_in_poltergeist(@session_creator)
|
||||
|
||||
sign_out_poltergeist
|
||||
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed but wasn't approved
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed and was approved
|
||||
end
|
||||
|
||||
it "should render only for session invitees for sessions with closed RSVPs before session starts" do
|
||||
# attempt to access with musician who wasn't invited
|
||||
|
||||
|
||||
# attempt to access with musician who was invited but didn't RSVP
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed but wasn't approved
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed and was approved
|
||||
end
|
||||
|
||||
# musician_access = false, approval_required = false
|
||||
it "should allow only RSVP approvals to view for 'XXX' option after session starts" do
|
||||
# attempt to access with musician who wasn't invited
|
||||
|
||||
|
||||
# attempt to access with musician who was invited but didn't RSVP
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed but wasn't approved
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed and was approved
|
||||
end
|
||||
|
||||
# musician_access = true, approval_required = false
|
||||
it "should allow anyone to view for 'at will' option after session starts" do
|
||||
# attempt to access with musician who wasn't invited
|
||||
|
||||
|
||||
# attempt to access with musician who was invited but didn't RSVP
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed but wasn't approved
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed and was approved
|
||||
end
|
||||
|
||||
# musician_access = true, approval_required = true
|
||||
it "should allow anyone to view for 'join by approval' option after session starts" do
|
||||
# attempt to access with musician who wasn't invited
|
||||
|
||||
|
||||
# attempt to access with musician who was invited but didn't RSVP
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed but wasn't approved
|
||||
|
||||
|
||||
# attempt to access with musician who RSVP'ed and was approved
|
||||
end
|
||||
|
||||
it "should render all required information" do
|
||||
# access with a user who was invited but hasn't RSVPed yet
|
||||
|
||||
|
||||
# session creator
|
||||
|
||||
# date/time
|
||||
|
||||
# genre
|
||||
|
||||
# name
|
||||
|
||||
# description
|
||||
|
||||
# notation files
|
||||
|
||||
# language
|
||||
|
||||
# access
|
||||
|
||||
# legal info
|
||||
|
||||
# view comments
|
||||
|
||||
|
||||
# sidebar - Approved RSVPs
|
||||
|
||||
# sidebar - Open Slots
|
||||
|
||||
# sidebar - Pending Invitations
|
||||
end
|
||||
|
||||
it "should allow only RSVP approvals or session invitees to add comments" do
|
||||
end
|
||||
|
||||
it "should show no call to action button if user has not RSVPed and all slots are taken" do
|
||||
end
|
||||
|
||||
it "should show no call to action button if the session organizer is viewing" do
|
||||
end
|
||||
end
|
||||
|
||||
# musician_access = true, approval_required = true
|
||||
it "should allow anyone to view for 'join by approval' option after session starts" do
|
||||
describe "actions" do
|
||||
it "should show RSVP Now button and launch submit dialog if user has not RSVPed" do
|
||||
end
|
||||
|
||||
it "should show Cancel RSVP button and launch cancel dialog if user has RSVPed" do
|
||||
end
|
||||
|
||||
it "should refresh sidebar RSVP section after user submits RSVP request" do
|
||||
end
|
||||
|
||||
it "should refresh sidebar Still Needed section after user cancels RSVP request" do
|
||||
end
|
||||
end
|
||||
|
||||
it "should render session info" do
|
||||
# session creator
|
||||
|
||||
# date/time
|
||||
|
||||
# genre
|
||||
|
||||
# name
|
||||
|
||||
# description
|
||||
|
||||
# notation files
|
||||
|
||||
# language
|
||||
|
||||
# access
|
||||
|
||||
# legal info
|
||||
|
||||
# comments section
|
||||
|
||||
# sidebar - Approved RSVPs
|
||||
|
||||
# sidebar - Open Slots
|
||||
|
||||
# sidebar - Pending Invitations
|
||||
end
|
||||
|
||||
it "should allow only RSVP approvals or session invitees to add comments" do
|
||||
end
|
||||
|
||||
it "should show Submit RSVP button and launch submit dialog if user has not RSVPed" do
|
||||
end
|
||||
|
||||
it "should show Cancel RSVP button and launch cancel dialog if user has RSVPed" do
|
||||
end
|
||||
|
||||
it "should show no call to action button if user has not RSVPed and all slots are taken" do
|
||||
end
|
||||
|
||||
it "should refresh sidebar RSVP section after user submits RSVP request" do
|
||||
end
|
||||
|
||||
it "should refresh sidebar Still Needed section after user cancels RSVP request" do
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Reference in New Issue