VRFS-1749 session info tests

This commit is contained in:
Brian Smith 2014-06-15 15:49:43 -04:00
parent a557e9966a
commit 7f3f47c3e6
5 changed files with 13 additions and 18 deletions

View File

@ -10,6 +10,8 @@ module JamRuby
attr_accessor :legal_terms, :language_description, :scheduled_start_time, :access_description
attr_accessor :approved_rsvps, :open_slots, :pending_invitations
self.table_name = "music_sessions"
self.primary_key = 'id'

View File

@ -9,7 +9,6 @@ class MusicSessionsController < ApplicationController
def session_info
@can_view = true
@can_comment = false
# check whether user is logged in
if current_user.nil?
@ -28,15 +27,8 @@ class MusicSessionsController < ApplicationController
if @music_session.scheduled_start > Time.now.utc
if @music_session.creator.id == current_user.id || @music_session.open_rsvps || has_invitation
@can_view = true
@can_comment = true
else
@can_view = false
@can_comment = false
end
# only allow comments for invitees before the session has started
unless has_invitation
@can_comment = true
end
# session has started

View File

@ -1,6 +1,6 @@
object @rsvp_request
attributes :id, :canceled, :cancel_all, :created_at
attributes :id, :user_id, :canceled, :cancel_all, :created_at
child(:user => :user) {
attributes :id, :name, :photo_url

View File

@ -15,7 +15,7 @@
%span.f12 Session Creator
%br/
%br/
- if current_user.id != @music_session.creator.id
- if current_user.id != @music_session.creator.id || (@open_slots.blank? && !@approved_rsvps.include?(current_user))
.f12.call-to-action
%br/
%a.button-orange{:id => "btn-action"}

View File

@ -108,9 +108,6 @@ describe "Session Info", :js => true, :type => :feature, :capybara_feature => tr
# right sidebar - Pending Invitations
find('div[user-id="' + @session_invitee.id + '"]')
# comments
find('#txtSessionInfoComment')
end
def ensure_failure
@ -295,13 +292,17 @@ describe "Session Info", :js => true, :type => :feature, :capybara_feature => tr
sign_out_poltergeist
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
pending
rs2 = RsvpRequestRsvpSlot.find_by_rsvp_request_id_and_rsvp_slot_id(@rsvp1.id, @slot2.id)
it "should show no call to action button for session organizer" do
# approve slot 2 as well to make all slots taken for this session
RsvpRequest.update({:id => @rsvp1.id, :session_id => @music_session.id, :rsvp_responses => [{:request_slot_id => rs2.id, :accept => true}]}, @session_creator)
sign_in_poltergeist(@session_invitee)
visit @url
expect {find('#btn-action')}.to raise_error(Capybara::ElementNotFound)
sign_out_poltergeist
end
end