diff --git a/Gemfile.lock b/Gemfile.lock index 80ddc6a54..55188ba63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,7 +45,7 @@ GEM builder (3.0.4) bullet (4.6.0) uniform_notifier - capybara (2.1.0) + capybara (2.2.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -57,7 +57,7 @@ GEM childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) chunky_png (1.2.8) - cliver (0.2.2) + cliver (0.3.2) coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -161,9 +161,9 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) method_source (0.8.2) - mime-types (1.25) - mini_portile (0.5.1) - multi_json (1.8.0) + mime-types (1.25.1) + mini_portile (0.5.2) + multi_json (1.8.2) multipart-post (1.2.0) nested_form (0.3.2) nokogiri (1.6.0) @@ -185,9 +185,9 @@ GEM omniauth (~> 1.0) orm_adapter (0.4.0) pg (0.17.0) - poltergeist (1.4.1) - capybara (~> 2.1.0) - cliver (~> 0.2.1) + poltergeist (1.5.0) + capybara (~> 2.1) + cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) polyglot (0.3.3) @@ -313,7 +313,7 @@ GEM addressable (>= 2.2.7) crack (>= 0.3.2) websocket (1.0.7) - websocket-driver (0.3.0) + websocket-driver (0.3.1) xpath (2.0.0) nokogiri (~> 1.3) diff --git a/spec/features/section_arranger_request_spec.rb b/spec/features/section_arranger_request_spec.rb new file mode 100644 index 000000000..e37489511 --- /dev/null +++ b/spec/features/section_arranger_request_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +describe "arranging sections for an event", js: true do + before do + @event = create(:event) + create(:event_session, event: @event) + @event.reload.event_sessions.count.should == 2 + + @session1, @session2 = @event.event_sessions.all + + @session1_rsvp = create(:student_rsvp, event: @event, class_level: 1) + create(:rsvp_session, rsvp: @session1_rsvp, event_session: @session1, checked_in: true) + create(:rsvp_session, rsvp: @session1_rsvp, event_session: @session2, checked_in: false) + + @session2_rsvp = create(:student_rsvp, event: @event, class_level: 2) + create(:rsvp_session, rsvp: @session2_rsvp, event_session: @session1, checked_in: false) + create(:rsvp_session, rsvp: @session2_rsvp, event_session: @session2, checked_in: true) + + @both_rsvp = create(:student_rsvp, event: @event, class_level: 3) + create(:rsvp_session, rsvp: @both_rsvp, event_session: @session1, checked_in: true) + create(:rsvp_session, rsvp: @both_rsvp, event_session: @session2, checked_in: true) + + @neither_attendee = create(:student_rsvp, event: @event, class_level: 4) + create(:rsvp_session, rsvp: @neither_attendee, event_session: @session1, checked_in: false) + create(:rsvp_session, rsvp: @neither_attendee, event_session: @session2, checked_in: false) + + @user_organizer = create(:user) + @event.organizers << @user_organizer + sign_in_as @user_organizer + end + + it "groups the attendees by their chosen level" do + visit organize_sections_event_path(@event) + + page.should have_css('.auto-assign-reminder') + + within '#section-organizer' do + click_on "Auto-Arrange" + end + + within '#auto_arrange_choices' do + page.find("[value='#{@session1.id}']").click + click_on "Auto-Arrange" + end + + page.should_not have_css('.auto-assign-reminder') + + within '.bridgetroll-section-level.level1' do + page.should have_content(@session1_rsvp.user.full_name) + end + + within '.bridgetroll-section-level.level3' do + page.should have_content(@both_rsvp.user.full_name) + end + + counts = (1..5).map do |level| + page.all(".bridgetroll-section-level.level#{level} .bridgetroll-section").length + end + counts.should == [1, 0, 1, 0, 0] + end +end