2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-08-07 21:33:08 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
feature Contact do
|
|
|
|
|
|
2014-08-12 22:11:07 +03:00
|
|
|
let!(:conference) { create(:conference) }
|
2019-03-13 10:31:42 +01:00
|
|
|
let!(:organizer) { create(:organizer, resource: conference) }
|
2014-08-07 21:33:08 +02:00
|
|
|
|
2018-11-13 13:47:20 -08:00
|
|
|
shared_examples 'contact field' do |field_name, field_value|
|
|
|
|
|
it 'updates a contact' do
|
2014-08-07 21:33:08 +02:00
|
|
|
contact = conference.contact
|
|
|
|
|
expected_count = Contact.count
|
|
|
|
|
|
|
|
|
|
visit edit_admin_conference_contact_path(conference.short_title)
|
2018-11-13 13:47:20 -08:00
|
|
|
fill_in 'contact_' + field_name, with: field_value
|
2014-08-07 21:33:08 +02:00
|
|
|
click_button 'Update Contact'
|
2025-08-06 13:04:53 +02:00
|
|
|
within('#flash') { expect(page).to have_text('Contact details were successfully updated.') }
|
2018-11-13 13:47:20 -08:00
|
|
|
|
2025-08-06 13:04:53 +02:00
|
|
|
expect(contact.reload.send(field_name)).to eq(field_value)
|
2014-08-07 21:33:08 +02:00
|
|
|
expect(Contact.count).to eq(expected_count)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe 'organizer' do
|
2018-11-13 13:47:20 -08:00
|
|
|
before do
|
|
|
|
|
sign_in organizer
|
|
|
|
|
end
|
2014-08-07 21:33:08 +02:00
|
|
|
|
2018-11-13 13:47:20 -08:00
|
|
|
context 'editing', feature: true do
|
|
|
|
|
it_behaves_like 'contact field', 'email', 'example@example.com'
|
|
|
|
|
it_behaves_like 'contact field', 'sponsor_email', 'sponsor@example.com'
|
|
|
|
|
it_behaves_like 'contact field', 'social_tag', 'example'
|
|
|
|
|
it_behaves_like 'contact field', 'facebook', 'http://www.facebook.com'
|
|
|
|
|
it_behaves_like 'contact field', 'twitter', 'http://www.twitter.com'
|
|
|
|
|
it_behaves_like 'contact field', 'instagram', 'http://www.instagram.com'
|
|
|
|
|
it_behaves_like 'contact field', 'googleplus', 'http://www.google.com'
|
|
|
|
|
it_behaves_like 'contact field', 'blog', 'http://blog.localdomain'
|
|
|
|
|
it_behaves_like 'contact field', 'youtube', 'https://youtube.com/osem'
|
|
|
|
|
end
|
|
|
|
|
end
|
2014-08-07 21:33:08 +02:00
|
|
|
end
|