diff --git a/app/views/events/emails/new.html.erb b/app/views/events/emails/new.html.erb
index c0e5787e6..34a167d37 100644
--- a/app/views/events/emails/new.html.erb
+++ b/app/views/events/emails/new.html.erb
@@ -47,10 +47,10 @@
<%= label_tag do %>
- <%= f.check_box(:include_waitlisted, class: 'include-waitlisted') %> Include waitlisted students
+ <%= f.check_box(:include_waitlisted, {class: 'include-waitlisted'}, true, false) %> Include waitlisted students
<% end %>
<%= label_tag do %>
- <%= f.check_box(:only_checked_in, class: 'only-checked-in') %> Only attendees who checked in (Good for
+ <%= f.check_box(:only_checked_in, {class: 'only-checked-in'}, true, false) %> Only attendees who checked in (Good for
post-event emails)
<% end %>
diff --git a/spec/controllers/events/emails_controller_spec.rb b/spec/controllers/events/emails_controller_spec.rb
index d910efabd..c2bf48fe8 100644
--- a/spec/controllers/events/emails_controller_spec.rb
+++ b/spec/controllers/events/emails_controller_spec.rb
@@ -35,7 +35,7 @@
it "allows emails to be sent to waitlisted students" do
expect {
- post :create, event_id: @event.id, event_email: mail_params.merge(attendee_group: Role::STUDENT.id, include_waitlisted: true)
+ post :create, event_id: @event.id, event_email: mail_params.merge(attendee_group: Role::STUDENT.id, include_waitlisted: "true")
}.to change(ActionMailer::Base.deliveries, :count).by(1)
recipients.should =~ [@student.email, @waitlisted.email, @organizer.email]
end
@@ -47,7 +47,7 @@
it "allows emails to be sent exclusively to checked-in attendees" do
expect {
- post :create, event_id: @event.id, event_email: mail_params.merge(attendee_group: 'All', only_checked_in: true)
+ post :create, event_id: @event.id, event_email: mail_params.merge(attendee_group: 'All', only_checked_in: "true")
}.to change(ActionMailer::Base.deliveries, :count).by(1)
recipients.should =~ [@volunteer.email, @organizer.email]
end
diff --git a/spec/features/event_email_request_spec.rb b/spec/features/event_email_request_spec.rb
index 24efdcb76..bc54ba6b5 100644
--- a/spec/features/event_email_request_spec.rb
+++ b/spec/features/event_email_request_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe "the email page" do
+ let(:recipients) { JSON.parse(ActionMailer::Base.deliveries.last.header['X-SMTPAPI'].to_s)['to'] }
+
before do
event = create(:event, student_rsvp_limit: 1)
@@ -42,4 +44,13 @@
check 'Only attendees who checked in'
page.should have_content("1 person")
end
+
+ it "sends an email to the selected people" do
+ choose 'All Attendees'
+ fill_in 'Subject', with: 'Hello, Railsbridgers'
+ fill_in 'Body', with: 'This is a cool email body!'
+ click_button 'Send Mail'
+
+ recipients.length.should == 4
+ end
end