VRFS-1690 add autoapprove option to RSVP creation

This commit is contained in:
Brian Smith 2014-06-16 08:11:05 -04:00
parent 87a74e235d
commit 35f630bdd7
2 changed files with 15 additions and 0 deletions

View File

@ -97,6 +97,7 @@ module JamRuby
rsvp_request_rsvp_slot = RsvpRequestRsvpSlot.new
rsvp_request_rsvp_slot.rsvp_request = @rsvp
rsvp_request_rsvp_slot.rsvp_slot = rsvp_slot
rsvp_request_rsvp_slot.chosen = true if params[:autoapprove] == true
rsvp_request_rsvp_slot.save
instruments << rsvp_slot.instrument_id

View File

@ -101,6 +101,20 @@ describe RsvpRequest do
it "should not allow non-invitee to RSVP to session with closed RSVPs" do
expect {RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id, @slot2.id]}, @non_session_invitee)}.to raise_error(JamRuby::PermissionError)
end
it "should allow RSVP creation with autoapprove option" do
# allow open RSVPs
@music_session.open_rsvps = true
@music_session.save
rsvp = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id, @slot2.id], :autoapprove => true}, @session_creator)
rs1 = RsvpRequestRsvpSlot.find_by_rsvp_slot_id(@slot1.id)
rs2 = RsvpRequestRsvpSlot.find_by_rsvp_slot_id(@slot2.id)
rs1.chosen.should == true
rs2.chosen.should == true
end
end
describe "index" do