Skip to content

Commit

Permalink
Only show confirmed RSVPs in the organizer childcare summary
Browse files Browse the repository at this point in the history
  • Loading branch information
tjgrathwell committed Apr 3, 2015
1 parent 8433505 commit 7389076
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/event.rb
Expand Up @@ -58,7 +58,7 @@ def location_city_and_state
end

def rsvps_with_childcare
rsvps.needs_childcare
rsvps.confirmed.needs_childcare
end

def historical?
Expand Down
11 changes: 8 additions & 3 deletions spec/models/event_spec.rb
Expand Up @@ -105,9 +105,14 @@
end

describe '#rsvps_with_childcare' do
it 'includes all rsvps with childcare requested' do
event = create(:event)
event.rsvps_with_childcare.should == event.student_rsvps.needs_childcare + event.volunteer_rsvps.needs_childcare
let(:event) { create(:event, student_rsvp_limit: 1) }
let!(:volunteer_rsvp) { create(:volunteer_rsvp, event: event) }
let!(:student_rsvp) { create(:student_rsvp, event: event) }
let!(:waitlisted_rsvp) { create(:student_rsvp, event: event, waitlist_position: 1) }

it 'includes all confirmed rsvps with childcare requested' do
event.rsvps.count.should == 3
event.rsvps_with_childcare.should match_array([student_rsvp, volunteer_rsvp])
end
end

Expand Down

0 comments on commit 7389076

Please sign in to comment.