Drop Organization from specs
This commit is contained in:
parent
275be8c80a
commit
85149dc837
19 changed files with 14 additions and 959 deletions
|
|
@ -4,8 +4,7 @@ require 'spec_helper'
|
|||
|
||||
feature 'Has correct abilities' do
|
||||
|
||||
let(:organization) { create(:organization) }
|
||||
let(:conference) { create(:full_conference, organization: organization) }
|
||||
let(:conference) { create(:full_conference) }
|
||||
let(:role_cfp) { Role.find_by(name: 'cfp', resource: conference) }
|
||||
let(:user_cfp) { create(:user, role_ids: [role_cfp.id]) }
|
||||
|
||||
|
|
@ -14,7 +13,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user_cfp
|
||||
end
|
||||
|
||||
scenario 'for organization and conference attributes' do
|
||||
scenario 'for conference attributes' do
|
||||
visit admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_path(conference.short_title))
|
||||
|
||||
|
|
@ -169,15 +168,6 @@ feature 'Has correct abilities' do
|
|||
visit admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_path(conference.short_title))
|
||||
|
||||
visit admin_organizations_path
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
|
||||
visit edit_admin_organization_path(organization)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit new_admin_organization_path
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit edit_admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,91 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Code of Conduct:' do
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:conference) { create(:full_conference, organization: organization) }
|
||||
let(:admin) { create(:admin) }
|
||||
let(:sample_text) { Faker::Lorem.paragraph }
|
||||
|
||||
context 'on an organization' do
|
||||
describe 'as admin' do
|
||||
before { sign_in admin }
|
||||
|
||||
it 'can add and remove' do
|
||||
visit admin_organizations_path
|
||||
within "tr#organization-#{organization.id}" do
|
||||
expect(page).not_to have_css 'i.fa-check'
|
||||
click_on 'Edit'
|
||||
end
|
||||
expect(page).to have_field 'organization[code_of_conduct]', with: ''
|
||||
fill_in 'organization[code_of_conduct]', with: sample_text
|
||||
click_on 'Update Organization'
|
||||
within "tr#organization-#{organization.id}" do
|
||||
expect(page).to have_css 'i.fa-check'
|
||||
click_on 'Edit'
|
||||
end
|
||||
expect(page).to have_field 'organization[code_of_conduct]', with: sample_text
|
||||
fill_in 'organization[code_of_conduct]', with: ''
|
||||
click_on 'Update Organization'
|
||||
within "tr#organization-#{organization.id}" do
|
||||
expect(page).not_to have_css 'i.fa-check'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'anonymously' do
|
||||
let!(:organization) { create(:organization, code_of_conduct: sample_text) }
|
||||
|
||||
context 'on the organization' do
|
||||
it 'can be read' do
|
||||
visit organizations_path
|
||||
within "#organization-#{organization.id}" do
|
||||
click_on 'Code of Conduct'
|
||||
end
|
||||
expect(page).to have_text(sample_text)
|
||||
end
|
||||
end
|
||||
|
||||
context 'on a conference' do
|
||||
it 'is linked from the index' do
|
||||
visit conferences_path
|
||||
within "#conference-#{conference.id}" do
|
||||
click_on 'Code of Conduct'
|
||||
end
|
||||
expect(page).to have_text(sample_text)
|
||||
end
|
||||
|
||||
it 'is included in the splash page', js: true do
|
||||
visit conference_path(conference)
|
||||
click_on 'Code of Conduct'
|
||||
expect(page).to have_text(sample_text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'as a participant' do
|
||||
let!(:organization) { create(:organization, code_of_conduct: sample_text) }
|
||||
let!(:participant) { create(:user) }
|
||||
|
||||
before do
|
||||
sign_in participant
|
||||
visit conferences_path
|
||||
within "#conference-#{conference.id}" do
|
||||
click_on 'Register'
|
||||
end
|
||||
end
|
||||
|
||||
it 'can be viewed', js: true do
|
||||
page.find('input#registration_accepted_code_of_conduct')
|
||||
expect(page).to have_text('I have read and accept the Code of Conduct')
|
||||
expect(page).not_to have_text(sample_text)
|
||||
within 'form' do
|
||||
click_on 'Code of Conduct'
|
||||
end
|
||||
page.find('.modal-dialog')
|
||||
expect(page).to have_content(sample_text)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -4,17 +4,9 @@ require 'spec_helper'
|
|||
|
||||
feature Conference do
|
||||
let(:user) { create(:admin) }
|
||||
let!(:organization) { create(:organization) }
|
||||
|
||||
describe 'admin' do
|
||||
let(:conference) { create(:conference, organization: organization) }
|
||||
|
||||
scenario 'has organization name in menu bar for conference views', feature: true, js: true do
|
||||
sign_in user
|
||||
visit admin_conference_path(conference.short_title)
|
||||
|
||||
expect(find('.navbar-brand').text).to eq(conference.organization.name)
|
||||
end
|
||||
let(:conference) { create(:conference) }
|
||||
|
||||
scenario 'adds a new conference', feature: true, js: true do
|
||||
expected_count = Conference.count + 1
|
||||
|
|
@ -22,7 +14,6 @@ feature Conference do
|
|||
|
||||
visit new_admin_conference_path
|
||||
|
||||
select organization.name, from: 'conference_organization_id'
|
||||
fill_in 'conference_title', with: 'Example Con'
|
||||
fill_in 'conference_short_title', with: 'ExCon'
|
||||
|
||||
|
|
@ -37,7 +28,6 @@ feature Conference do
|
|||
expect(flash)
|
||||
.to eq('Conference was successfully created.')
|
||||
expect(Conference.count).to eq(expected_count)
|
||||
expect(Conference.last.organization).to eq(organization)
|
||||
user.reload
|
||||
expect(user.has_cached_role? :organizer, Conference.last).to be(true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ require 'spec_helper'
|
|||
|
||||
feature 'Has correct abilities' do
|
||||
|
||||
let(:organization) { create(:organization) }
|
||||
let(:conference) { create(:full_conference, organization: organization) }
|
||||
let(:conference) { create(:full_conference) }
|
||||
let(:role_info_desk) { Role.find_by(name: 'info_desk', resource: conference) }
|
||||
let(:user_info_desk) { create(:user, role_ids: [role_info_desk.id]) }
|
||||
|
||||
|
|
@ -14,7 +13,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user_info_desk
|
||||
end
|
||||
|
||||
scenario 'for organization and conference attributes' do
|
||||
scenario 'for conference attributes' do
|
||||
visit admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_path(conference.short_title))
|
||||
|
||||
|
|
@ -47,15 +46,6 @@ feature 'Has correct abilities' do
|
|||
expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails")
|
||||
expect(page).to_not have_link('New Conference', href: '/admin/conferences/new')
|
||||
|
||||
visit admin_organizations_path
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
|
||||
visit edit_admin_organization_path(organization)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit new_admin_organization_path
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit edit_admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,259 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Has correct abilities' do
|
||||
let(:organization) { create(:organization) }
|
||||
let(:conference) { create(:full_conference, organization: organization) }
|
||||
let(:role_organization_admin) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
let(:user_organization_admin) { create(:user, role_ids: [role_organization_admin.id]) }
|
||||
let!(:registration_ticket) { create(:registration_ticket, conference: conference) }
|
||||
|
||||
context 'when user is organization_admin' do
|
||||
before do
|
||||
sign_in user_organization_admin
|
||||
end
|
||||
|
||||
scenario 'for organization attributes' do
|
||||
visit admin_organizations_path
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
|
||||
visit edit_admin_organization_path(organization)
|
||||
expect(current_path).to eq(edit_admin_organization_path(organization))
|
||||
|
||||
visit new_admin_organization_path
|
||||
expect(current_path).to eq(root_path)
|
||||
end
|
||||
|
||||
scenario 'for conference attributes' do
|
||||
visit admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_path(conference.short_title))
|
||||
|
||||
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
|
||||
expect(page).to have_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit")
|
||||
expect(page).to have_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit")
|
||||
expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference.short_title}/commercials")
|
||||
expect(page).to have_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage")
|
||||
expect(page).to have_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue")
|
||||
expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms")
|
||||
expect(page).to have_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings")
|
||||
expect(page).to have_link('Program', href: "/admin/conferences/#{conference.short_title}/program")
|
||||
expect(page).to have_link('Calls for Content', href: "/admin/conferences/#{conference.short_title}/program/cfps")
|
||||
expect(page).to have_link('Events', href: "/admin/conferences/#{conference.short_title}/program/events")
|
||||
expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference.short_title}/program/tracks")
|
||||
expect(page).to have_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types")
|
||||
expect(page).to have_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels")
|
||||
expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules")
|
||||
expect(page).to have_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports")
|
||||
expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations")
|
||||
expect(page).to have_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period")
|
||||
expect(page).to have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions")
|
||||
expect(page).to have_text('Donations')
|
||||
expect(page).to have_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels")
|
||||
expect(page).to have_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors")
|
||||
expect(page).to have_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets")
|
||||
expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails")
|
||||
expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles")
|
||||
expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources")
|
||||
expect(page).to have_link('New Conference', href: '/admin/conferences/new')
|
||||
|
||||
visit edit_admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_contact_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_contact_path(conference.short_title))
|
||||
|
||||
visit admin_conference_commercials_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_commercials_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_splashpage_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_splashpage_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_splashpage_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_splashpage_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_venue_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_venue_path(conference.short_title))
|
||||
|
||||
conference.venue = create(:venue)
|
||||
visit edit_admin_conference_venue_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_venue_path(conference.short_title))
|
||||
|
||||
visit admin_conference_venue_rooms_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_venue_rooms_path(conference.short_title))
|
||||
|
||||
create(:room, venue: conference.venue)
|
||||
visit edit_admin_conference_venue_room_path(conference.short_title, conference.venue.rooms.first)
|
||||
expect(current_path).to eq(edit_admin_conference_venue_room_path(conference.short_title, conference.venue.rooms.first))
|
||||
|
||||
visit admin_conference_lodgings_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_lodgings_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_lodging_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_lodging_path(conference.short_title))
|
||||
|
||||
create(:lodging, conference: conference)
|
||||
visit edit_admin_conference_lodging_path(conference.short_title, conference.lodgings.first)
|
||||
expect(current_path).to eq(edit_admin_conference_lodging_path(conference.short_title, conference.lodgings.first))
|
||||
|
||||
visit new_admin_conference_program_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_program_path(conference.short_title))
|
||||
|
||||
# Only event exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
# Event and booth cfps exist
|
||||
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
|
||||
# Event, booth, track cfps exist
|
||||
call_for_tracks = create(:cfp, cfp_type: 'tracks', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq root_path
|
||||
|
||||
# Booth and track cfps exist
|
||||
conference.program.cfp.destroy!
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
|
||||
# Only booth exists
|
||||
call_for_tracks.destroy!
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
|
||||
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
|
||||
|
||||
# No cfp exists
|
||||
cfb.destroy
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
# Only Tracks cfp exists
|
||||
call_for_tracks = create(:cfp, cfp_type: 'tracks', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, call_for_tracks)
|
||||
expect(current_path).to eq edit_admin_conference_program_cfp_path(conference.short_title, call_for_tracks)
|
||||
|
||||
# Event and track cfps exist
|
||||
create(:cfp, cfp_type: 'events', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
|
||||
call_for_tracks.destroy!
|
||||
visit admin_conference_program_events_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_events_path(conference.short_title))
|
||||
|
||||
create(:event, program: conference.program)
|
||||
visit edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first)
|
||||
expect(current_path).to eq(edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first))
|
||||
|
||||
visit admin_conference_program_event_types_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_event_types_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_program_event_type_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_event_type_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_event_type_path(conference.short_title, conference.program.event_types.first)
|
||||
expect(current_path).to eq(edit_admin_conference_program_event_type_path(conference.short_title, conference.program.event_types.first))
|
||||
|
||||
visit admin_conference_program_difficulty_levels_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_difficulty_levels_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_program_difficulty_level_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_difficulty_level_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_difficulty_level_path(conference.short_title, conference.program.difficulty_levels.first)
|
||||
expect(current_path).to eq(edit_admin_conference_program_difficulty_level_path(conference.short_title, conference.program.difficulty_levels.first))
|
||||
|
||||
visit admin_conference_schedules_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_schedules_path(conference.short_title))
|
||||
|
||||
create(:schedule, program: conference.program)
|
||||
visit admin_conference_schedule_path(conference.short_title, conference.program.schedules.first)
|
||||
expect(current_path).to eq(admin_conference_schedule_path(conference.short_title, conference.program.schedules.first))
|
||||
|
||||
visit admin_conference_program_reports_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_reports_path(conference.short_title))
|
||||
|
||||
visit admin_conference_registrations_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_registrations_path(conference.short_title))
|
||||
|
||||
create(:registration, user: create(:user), conference: conference)
|
||||
visit edit_admin_conference_registration_path(conference.short_title, conference.registrations.first)
|
||||
expect(current_path).to eq(edit_admin_conference_registration_path(conference.short_title, conference.registrations.first))
|
||||
|
||||
visit new_admin_conference_registration_period_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_registration_period_path(conference.short_title))
|
||||
|
||||
create(:registration_period, conference: conference)
|
||||
visit edit_admin_conference_registration_period_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_registration_period_path(conference.short_title))
|
||||
|
||||
visit admin_conference_questions_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_questions_path(conference.short_title))
|
||||
|
||||
visit admin_conference_sponsorship_levels_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_sponsorship_levels_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_sponsorship_level_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_sponsorship_level_path(conference.short_title))
|
||||
|
||||
create(:sponsorship_level, conference: conference)
|
||||
visit edit_admin_conference_sponsorship_level_path(conference.short_title, conference.sponsorship_levels.first)
|
||||
expect(current_path).to eq(edit_admin_conference_sponsorship_level_path(conference.short_title, conference.sponsorship_levels.first))
|
||||
|
||||
visit admin_conference_sponsors_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_sponsors_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_sponsor_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_sponsor_path(conference.short_title))
|
||||
|
||||
create(:sponsor, conference: conference, sponsorship_level: conference.sponsorship_levels.first)
|
||||
visit edit_admin_conference_sponsor_path(conference.short_title, conference.sponsors.first)
|
||||
expect(current_path).to eq(edit_admin_conference_sponsor_path(conference.short_title, conference.sponsors.first))
|
||||
|
||||
visit admin_conference_tickets_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_tickets_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_ticket_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_ticket_path(conference.short_title))
|
||||
|
||||
create(:ticket, conference: conference)
|
||||
visit edit_admin_conference_ticket_path(conference.short_title, conference.tickets.first)
|
||||
expect(current_path).to eq(edit_admin_conference_ticket_path(conference.short_title, conference.tickets.first))
|
||||
|
||||
visit admin_conference_program_tracks_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_tracks_path(conference.short_title))
|
||||
|
||||
visit admin_conference_roles_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_roles_path(conference.short_title))
|
||||
|
||||
visit admin_conference_emails_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_emails_path(conference.short_title))
|
||||
|
||||
visit admin_conference_resources_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_resources_path(conference.short_title))
|
||||
|
||||
visit new_admin_conference_resource_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_resource_path(conference.short_title))
|
||||
|
||||
create(:resource, conference: conference)
|
||||
visit edit_admin_conference_resource_path(conference.short_title, conference.resources.first)
|
||||
expect(current_path).to eq(edit_admin_conference_resource_path(conference.short_title, conference.resources.first))
|
||||
|
||||
visit admin_revision_history_path
|
||||
expect(current_path).to eq(admin_revision_history_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature Organization do
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:organization_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
let(:organization_admin) { create(:user, role_ids: [organization_admin_role.id]) }
|
||||
let(:admin_user) { create(:admin) }
|
||||
|
||||
shared_examples 'successfully updates an organization' do
|
||||
scenario 'updates a exsisting organization', feature: true, js: true do
|
||||
visit edit_admin_organization_path(organization)
|
||||
fill_in 'organization_name', with: 'changed name'
|
||||
|
||||
click_button 'Update Organization'
|
||||
|
||||
organization.reload
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Organization successfully updated')
|
||||
expect(organization.name).to eq('changed name')
|
||||
end
|
||||
end
|
||||
|
||||
context 'signed in as site admin' do
|
||||
before do
|
||||
sign_in admin_user
|
||||
end
|
||||
scenario 'creates a new organization', feature: true, js: true do
|
||||
visit new_admin_organization_path
|
||||
fill_in 'organization_name', with: 'Organization name'
|
||||
|
||||
click_button 'Create Organization'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Organization successfully created')
|
||||
expect(Organization.last.name).to eq('Organization name')
|
||||
end
|
||||
|
||||
it_behaves_like 'successfully updates an organization'
|
||||
end
|
||||
|
||||
context 'signed in as organization admin' do
|
||||
before do
|
||||
sign_in organization_admin
|
||||
end
|
||||
scenario "can't create new organization", feature: true, js: true do
|
||||
visit new_admin_organization_path
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('You are not authorized to access this page.')
|
||||
end
|
||||
|
||||
it_behaves_like 'successfully updates an organization'
|
||||
end
|
||||
|
||||
context 'anonymously' do
|
||||
scenario 'index should link to conferences list' do
|
||||
visit organizations_path
|
||||
|
||||
expect(page).to have_link('Conferences', href: "/organizations/#{organization.id}/conferences")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -4,9 +4,8 @@ require 'spec_helper'
|
|||
|
||||
feature 'Has correct abilities' do
|
||||
|
||||
let(:organization) { create(:organization) }
|
||||
let(:conference) { create(:full_conference, organization: organization) }
|
||||
let(:other_conference) { create(:conference, organization: organization) } # user is organizer, venue is not set by default
|
||||
let(:conference) { create(:full_conference) }
|
||||
let(:other_conference) { create(:conference) } # user is organizer, venue is not set by default
|
||||
let(:role_organizer_conf) { Role.find_by(name: 'organizer', resource: conference) }
|
||||
let(:role_organizer_other_conf) { Role.find_by(name: 'organizer', resource: other_conference) }
|
||||
let(:user_organizer) { create(:user, role_ids: [role_organizer_conf.id, role_organizer_other_conf.id]) }
|
||||
|
|
@ -17,17 +16,6 @@ feature 'Has correct abilities' do
|
|||
sign_in user_organizer
|
||||
end
|
||||
|
||||
scenario 'for organization attributes' do
|
||||
visit admin_organizations_path
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
|
||||
visit edit_admin_organization_path(organization)
|
||||
expect(current_path).to eq(root_path)
|
||||
|
||||
visit new_admin_organization_path
|
||||
expect(current_path).to eq(root_path)
|
||||
end
|
||||
|
||||
scenario 'for conference attributes' do
|
||||
visit admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_path(conference.short_title))
|
||||
|
|
|
|||
|
|
@ -101,52 +101,6 @@ feature Role do
|
|||
end
|
||||
end
|
||||
|
||||
context 'organization_admin' do
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:org_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
let!(:organization_admin) { create(:user, role_ids: [org_admin_role.id]) }
|
||||
let(:user_with_no_role) { create :user }
|
||||
let!(:other_organization) { create(:organization) }
|
||||
|
||||
before do
|
||||
sign_in organization_admin
|
||||
visit admin_organizations_path
|
||||
end
|
||||
|
||||
context 'for the organization it belongs to' do
|
||||
scenario 'successfully adds role organization_admin' do
|
||||
click_link('Admins', href: admins_admin_organization_path(organization.id))
|
||||
|
||||
fill_in 'user_email', with: user_with_no_role.email
|
||||
click_button 'Add'
|
||||
user_with_no_role.reload
|
||||
|
||||
expect(user_with_no_role.has_cached_role?('organization_admin', organization)).to be true
|
||||
end
|
||||
|
||||
scenario 'successfully removes role organization_admin' do
|
||||
click_link('Admins', href: admins_admin_organization_path(organization.id))
|
||||
|
||||
first('tbody > tr').find('.btn-danger').click
|
||||
organization_admin.reload
|
||||
expect(organization_admin.has_cached_role?('organization_admin', organization)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'for the organizations it does not belong to' do
|
||||
scenario 'does not successfully add role organization_admin' do
|
||||
click_link('Admins', href: admins_admin_organization_path(other_organization.id))
|
||||
|
||||
expect(page.has_field?('user_email')).to be false
|
||||
end
|
||||
|
||||
scenario 'does not successfully removes role organization_admin' do
|
||||
click_link('Admins', href: admins_admin_organization_path(other_organization.id))
|
||||
expect(page.has_css?('.btn-danger')).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'organizer' do
|
||||
Role.all.each.map(&:name).each do |role|
|
||||
it_behaves_like 'successfully', role, 'organizer'
|
||||
|
|
|
|||
|
|
@ -65,19 +65,4 @@ feature Splashpage do
|
|||
expect(current_path).to eq(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'navigation' do
|
||||
let!(:splashpage) { create(:splashpage, conference: conference, public: true)}
|
||||
|
||||
context 'multiple organizations' do
|
||||
let!(:additional_organization) { create(:organization) }
|
||||
|
||||
scenario 'should have organization name', feature: true, js: true do
|
||||
sign_in participant
|
||||
visit conference_path(conference.short_title)
|
||||
|
||||
expect(page).to have_text(conference.organization.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ require 'spec_helper'
|
|||
|
||||
feature 'Has correct abilities' do
|
||||
|
||||
let(:organization) { create(:organization) }
|
||||
let(:conference) { create(:full_conference, organization: organization) }
|
||||
let(:conference) { create(:full_conference) }
|
||||
let(:self_organized_track) { create(:track, :self_organized, program: conference.program, state: 'confirmed') }
|
||||
let(:role_track_organizer) { Role.where(name: 'track_organizer', resource: self_organized_track).first_or_create }
|
||||
let(:user_track_organizer) { create(:user, role_ids: [role_track_organizer.id]) }
|
||||
|
|
@ -15,7 +14,7 @@ feature 'Has correct abilities' do
|
|||
sign_in user_track_organizer
|
||||
end
|
||||
|
||||
scenario 'for organization and conference attributes' do
|
||||
scenario 'for conference attributes' do
|
||||
visit admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_path(conference.short_title))
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ require 'spec_helper'
|
|||
|
||||
feature 'Has correct abilities' do
|
||||
|
||||
let(:organization) { create(:organization) }
|
||||
let(:conference) { create(:full_conference, organization: organization) } # user is cfp
|
||||
let(:conference) { create(:full_conference) } # user is cfp
|
||||
let(:user) { create(:user) }
|
||||
|
||||
context 'when user has no role' do
|
||||
|
|
|
|||
|
|
@ -306,44 +306,6 @@ feature 'Version' do
|
|||
expect(page).to have_no_text('Someone (probably via the console) created new commercial')
|
||||
end
|
||||
|
||||
scenario 'display changes in organization', feature: true, versioning: true, js: true do
|
||||
admin = create(:admin)
|
||||
sign_in admin
|
||||
|
||||
visit new_admin_organization_path
|
||||
fill_in 'organization_name', with: 'New org'
|
||||
click_button 'Create Organization'
|
||||
|
||||
visit admin_revision_history_path
|
||||
expect(page).to have_text('created new organization New org')
|
||||
end
|
||||
|
||||
context 'organization role', feature: true, versioning: true, js: true do
|
||||
let!(:user) { create(:user) }
|
||||
let!(:role) do
|
||||
Role.find_by(
|
||||
resource_id: conference.organization.id,
|
||||
resource_type: 'Organization'
|
||||
)
|
||||
end
|
||||
|
||||
setup do
|
||||
user.add_role :organization_admin, conference.organization
|
||||
user.remove_role :organization_admin, conference.organization
|
||||
visit admin_revision_history_path
|
||||
end
|
||||
|
||||
it 'is recorded to history when user is added' do
|
||||
skip('fails since paper_trail 12.2.0')
|
||||
expect(page).to have_text(/added role organization_admin with ID \d+ to user #{user.name} in organization #{conference.organization.name}/)
|
||||
end
|
||||
|
||||
it 'is recorded to history when user is removed' do
|
||||
skip('fails since paper_trail 12.2.0')
|
||||
expect(page).to have_text(/removed role organization_admin with ID \d+ from user #{user.name} in organization #{conference.organization.name}/)
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'display changes in users_role for conference role', feature: true, versioning: true, js: true do
|
||||
user = create(:user)
|
||||
role = Role.find_by(name: 'cfp', resource_id: conference.id, resource_type: 'Conference')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue