2014-05-14 17:08:46 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
2014-08-05 18:23:42 +02:00
|
|
|
feature EmailSettings do
|
2014-08-12 15:48:29 +03:00
|
|
|
let!(:conference) { create(:conference) }
|
|
|
|
|
let!(:organizer_role) { create(:organizer_role, resource: conference) }
|
|
|
|
|
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
2014-05-14 17:08:46 +02:00
|
|
|
|
2014-08-12 15:48:29 +03:00
|
|
|
shared_examples 'email settings' do
|
2014-05-14 17:08:46 +02:00
|
|
|
scenario 'updates email settings',
|
|
|
|
|
feature: true, js: true do
|
|
|
|
|
|
|
|
|
|
expected_count = EmailSettings.count
|
|
|
|
|
|
2014-08-12 15:48:29 +03:00
|
|
|
sign_in organizer
|
2014-05-14 17:08:46 +02:00
|
|
|
|
|
|
|
|
visit admin_conference_emails_path(conference.short_title)
|
2015-01-15 12:22:36 +05:30
|
|
|
click_link 'Onboarding'
|
2014-05-14 17:08:46 +02:00
|
|
|
fill_in 'email_settings_registration_subject',
|
|
|
|
|
with: 'Registration subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_registration_body',
|
2014-05-14 17:08:46 +02:00
|
|
|
with: 'Registration email body'
|
2015-01-15 12:22:36 +05:30
|
|
|
click_link 'Proposal'
|
2014-05-14 17:08:46 +02:00
|
|
|
fill_in 'email_settings_accepted_subject',
|
|
|
|
|
with: 'Accepted subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_accepted_body',
|
2014-05-14 17:08:46 +02:00
|
|
|
with: 'Accepted email body'
|
|
|
|
|
|
|
|
|
|
fill_in 'email_settings_rejected_subject',
|
|
|
|
|
with: 'Rejected subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_rejected_body',
|
2014-05-14 17:08:46 +02:00
|
|
|
with: 'Rejected email body'
|
|
|
|
|
|
|
|
|
|
fill_in 'email_settings_confirmed_without_registration_subject',
|
|
|
|
|
with: 'Confirmed without registration subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_confirmed_without_registration_body',
|
2014-05-14 17:08:46 +02:00
|
|
|
with: 'Confirmed without registration email body'
|
|
|
|
|
|
2015-01-15 12:22:36 +05:30
|
|
|
click_link 'Update Notifications'
|
2014-07-23 13:42:03 +02:00
|
|
|
fill_in 'email_settings_updated_conference_dates_subject',
|
|
|
|
|
with: 'Updated conference dates subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_updated_conference_dates_body',
|
2014-07-23 13:42:03 +02:00
|
|
|
with: 'Updated conference dates email template'
|
|
|
|
|
|
|
|
|
|
fill_in 'email_settings_updated_conference_registration_dates_subject',
|
|
|
|
|
with: 'Updated conference registration dates subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_updated_conference_registration_dates_body',
|
2014-07-23 13:42:03 +02:00
|
|
|
with: 'Updated conference registration dates template'
|
|
|
|
|
|
|
|
|
|
fill_in 'email_settings_venue_update_subject',
|
|
|
|
|
with: 'Updated conference venue subject'
|
2015-10-06 11:32:40 +02:00
|
|
|
fill_in 'email_settings_venue_update_body',
|
2014-07-23 13:42:03 +02:00
|
|
|
with: 'Updated conference venue template'
|
|
|
|
|
|
2014-05-14 17:08:46 +02:00
|
|
|
click_button 'Update Email settings'
|
|
|
|
|
|
|
|
|
|
expect(flash).
|
|
|
|
|
to eq('Settings have been successfully updated.')
|
|
|
|
|
|
|
|
|
|
expect(find('#email_settings_registration_subject').
|
|
|
|
|
value).to eq('Registration subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_registration_body').
|
2014-05-14 17:08:46 +02:00
|
|
|
value).to eq('Registration email body')
|
2015-01-15 12:22:36 +05:30
|
|
|
click_link 'Proposal'
|
2014-05-14 17:08:46 +02:00
|
|
|
expect(find('#email_settings_accepted_subject').
|
|
|
|
|
value).to eq('Accepted subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_accepted_body').
|
2014-05-14 17:08:46 +02:00
|
|
|
value).to eq('Accepted email body')
|
|
|
|
|
expect(find('#email_settings_rejected_subject').
|
|
|
|
|
value).to eq('Rejected subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_rejected_body').
|
2014-05-14 17:08:46 +02:00
|
|
|
value).to eq('Rejected email body')
|
|
|
|
|
expect(find('#email_settings_confirmed_without_registration_subject').
|
|
|
|
|
value).to eq('Confirmed without registration subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_confirmed_without_registration_body').
|
2014-05-14 17:08:46 +02:00
|
|
|
value).to eq('Confirmed without registration email body')
|
2015-01-15 12:22:36 +05:30
|
|
|
click_link 'Update Notifications'
|
2014-07-23 13:42:03 +02:00
|
|
|
expect(find('#email_settings_updated_conference_dates_subject').
|
|
|
|
|
value).to eq('Updated conference dates subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_updated_conference_dates_body').
|
2014-07-23 13:42:03 +02:00
|
|
|
value).to eq('Updated conference dates email template')
|
|
|
|
|
expect(find('#email_settings_updated_conference_registration_dates_subject').
|
|
|
|
|
value).to eq('Updated conference registration dates subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_updated_conference_registration_dates_body').
|
2014-07-23 13:42:03 +02:00
|
|
|
value).to eq('Updated conference registration dates template')
|
|
|
|
|
expect(find('#email_settings_venue_update_subject').
|
|
|
|
|
value).to eq('Updated conference venue subject')
|
2015-10-06 11:32:40 +02:00
|
|
|
expect(find('#email_settings_venue_update_body').
|
2014-07-23 13:42:03 +02:00
|
|
|
value).to eq('Updated conference venue template')
|
2014-05-14 17:08:46 +02:00
|
|
|
|
|
|
|
|
expect(EmailSettings.count).to eq(expected_count)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe 'organizer' do
|
2014-08-12 15:48:29 +03:00
|
|
|
it_behaves_like 'email settings'
|
2014-05-14 17:08:46 +02:00
|
|
|
end
|
|
|
|
|
end
|