2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-06-05 20:05:20 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
feature Sponsor do
|
2014-08-12 15:48:29 +03:00
|
|
|
let!(:conference) { create(:conference) }
|
2019-03-13 10:31:42 +01:00
|
|
|
let!(:organizer) { create(:organizer, resource: conference) }
|
2014-06-05 20:05:20 +05:30
|
|
|
|
2014-08-12 15:48:29 +03:00
|
|
|
shared_examples 'sponsors' do
|
2014-06-05 20:05:20 +05:30
|
|
|
scenario 'adds and updates sponsors', feature: true, js: true do
|
|
|
|
|
path = "#{Rails.root}/app/assets/images/rails.png"
|
2014-08-12 15:48:29 +03:00
|
|
|
|
2014-06-05 20:05:20 +05:30
|
|
|
conference.sponsorship_levels << create(:sponsorship_level, conference: conference)
|
2014-08-12 15:48:29 +03:00
|
|
|
sign_in organizer
|
2014-07-04 22:35:47 +02:00
|
|
|
|
2014-06-05 20:05:20 +05:30
|
|
|
visit admin_conference_sponsors_path(
|
|
|
|
|
conference_id: conference.short_title)
|
|
|
|
|
# Add sponsors
|
2014-11-25 10:47:18 +01:00
|
|
|
click_link 'Add Sponsor'
|
2014-06-05 20:05:20 +05:30
|
|
|
|
2014-11-25 10:47:18 +01:00
|
|
|
fill_in 'sponsor_name', with: 'SUSE'
|
|
|
|
|
fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution'
|
2016-04-27 17:34:17 +02:00
|
|
|
attach_file 'Picture', path
|
2014-11-25 10:47:18 +01:00
|
|
|
fill_in 'sponsor_website_url', with: 'http://www.suse.com'
|
2016-05-02 15:25:18 +02:00
|
|
|
select(conference.sponsorship_levels.first.title, from: 'sponsor_sponsorship_level_id')
|
2014-06-05 20:05:20 +05:30
|
|
|
|
2014-11-25 10:47:18 +01:00
|
|
|
click_button 'Create Sponsor'
|
2025-08-06 13:04:53 +02:00
|
|
|
|
|
|
|
|
within('#flash') { expect(page).to have_text('Sponsor successfully created.') }
|
2014-11-25 10:47:18 +01:00
|
|
|
within('table#sponsors') do
|
|
|
|
|
expect(page.has_content?('SUSE')).to be true
|
|
|
|
|
expect(page.has_content?('The original provider')).to be true
|
|
|
|
|
expect(page.has_content?('http://www.suse.com')).to be true
|
2016-05-02 15:25:18 +02:00
|
|
|
expect(page.has_content?(conference.sponsorship_levels.first.title)).to be true
|
2014-11-25 10:47:18 +01:00
|
|
|
expect(page).to have_selector("img[src*='rails.png']")
|
|
|
|
|
expect(page.assert_selector('tr', count: 2)).to be true
|
|
|
|
|
end
|
2014-06-05 20:05:20 +05:30
|
|
|
|
|
|
|
|
# Remove sponsor
|
2017-10-12 14:06:02 -07:00
|
|
|
visit admin_conference_sponsors_path(
|
|
|
|
|
conference_id: conference.short_title
|
|
|
|
|
)
|
|
|
|
|
within('table#sponsors') do
|
|
|
|
|
page.accept_confirm do
|
|
|
|
|
click_link 'Delete'
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-08-06 13:04:53 +02:00
|
|
|
within('#flash') { expect(page).to have_text('Sponsor successfully deleted.') }
|
2024-12-02 11:43:43 +01:00
|
|
|
expect(page).to have_no_selector('table#sponsors')
|
2014-06-05 20:05:20 +05:30
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe 'organizer' do
|
2014-08-12 15:48:29 +03:00
|
|
|
it_behaves_like 'sponsors'
|
2014-06-05 20:05:20 +05:30
|
|
|
end
|
|
|
|
|
end
|