mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Drop Organization from specs
This commit is contained in:
parent
275be8c80a
commit
85149dc837
19 changed files with 14 additions and 959 deletions
|
|
@ -5,16 +5,13 @@ require 'spec_helper'
|
|||
describe Admin::ConferencesController do
|
||||
|
||||
# It is necessary to use bang version of let to build roles before user
|
||||
let!(:organization) { create(:organization, name: 'organization') }
|
||||
let!(:conference) { create(:conference, organization: organization, end_date: Date.new(2014, 05, 26) + 15) }
|
||||
let!(:organization_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
let(:organization_admin) { create(:user, role_ids: organization_admin_role.id) }
|
||||
let!(:conference) { create(:conference, end_date: Date.new(2014, 05, 26) + 15) }
|
||||
let(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||
let!(:organizer) { create(:organizer, resource: conference) }
|
||||
let!(:organizer2) { create(:organizer, email: 'organizer2@email.osem', resource: conference) }
|
||||
let(:participant) { create(:user) }
|
||||
|
||||
shared_examples 'access as organizer or organization_admin' do
|
||||
shared_examples 'access as organizer' do
|
||||
describe 'PATCH #update' do
|
||||
context 'valid attributes' do
|
||||
it 'locates the requested conference' do
|
||||
|
|
@ -197,95 +194,6 @@ describe Admin::ConferencesController do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples 'access as organization_admin' do
|
||||
describe 'POST #create' do
|
||||
context 'with valid attributes' do
|
||||
it 'saves the conference to the database' do
|
||||
expected = expect do
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id) }
|
||||
end
|
||||
expected.to change { Conference.count }.by 1
|
||||
end
|
||||
|
||||
it 'redirects to conference#show' do
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id) }
|
||||
|
||||
expect(response).to redirect_to admin_conference_path(
|
||||
assigns[:conference].short_title)
|
||||
end
|
||||
|
||||
it 'creates roles for the conference' do
|
||||
cfp_role = Role.find_by(name: 'cfp', resource: conference)
|
||||
info_desk_role = Role.find_by(name: 'info_desk', resource: conference)
|
||||
volunteers_coordinator_role = Role.find_by(name: 'volunteers_coordinator', resource: conference)
|
||||
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: 'dps15') }
|
||||
|
||||
expect(conference.roles.count).to eq 4
|
||||
|
||||
expect(conference.roles).to match_array [organizer_role, cfp_role, info_desk_role, volunteers_coordinator_role]
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid attributes' do
|
||||
it 'does not save the conference to the database' do
|
||||
expected = expect do
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id) }
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
||||
it 're-renders the new template' do
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id) }
|
||||
expect(response).to be_successful
|
||||
end
|
||||
end
|
||||
|
||||
context 'with duplicate conference short title' do
|
||||
it 'does not save the conference to the database' do
|
||||
conference
|
||||
expected = expect do
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id) }
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
||||
it 're-renders the new template' do
|
||||
conference
|
||||
post :create, params: { conference: attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id) }
|
||||
expect(response).to be_successful
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
it 'assigns a new conference to conference' do
|
||||
get :new
|
||||
expect(assigns(:conference)).to be_a_new(Conference)
|
||||
end
|
||||
|
||||
it 'renders the :new template' do
|
||||
get :new
|
||||
expect(response).to render_template :new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'organization admin access' do
|
||||
before do
|
||||
sign_in(organization_admin)
|
||||
end
|
||||
|
||||
it_behaves_like 'access as organizer or organization_admin'
|
||||
it_behaves_like 'access as organization_admin'
|
||||
end
|
||||
|
||||
shared_examples 'access as organizer, participant or guest' do |path, message|
|
||||
describe 'GET #new' do
|
||||
it 'requires organizer privileges' do
|
||||
|
|
@ -299,8 +207,7 @@ describe Admin::ConferencesController do
|
|||
|
||||
describe 'POST #create' do
|
||||
it 'requires organizer privileges' do
|
||||
post :create, params: { conference: attributes_for(:conference,
|
||||
short_title: 'ExCon', organization_id: organization.id) }
|
||||
post :create, params: { conference: attributes_for(:conference, short_title: 'ExCon') }
|
||||
expect(response).to redirect_to(send(path))
|
||||
if message
|
||||
expect(flash[:alert]).to match(/#{message}/)
|
||||
|
|
@ -314,7 +221,7 @@ describe Admin::ConferencesController do
|
|||
sign_in(organizer)
|
||||
end
|
||||
|
||||
it_behaves_like 'access as organizer or organization_admin'
|
||||
it_behaves_like 'access as organizer'
|
||||
it_behaves_like 'access as organizer, participant or guest', :root_path, 'You are not authorized to access this page.'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,200 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Admin::OrganizationsController do
|
||||
let!(:admin) { create(:admin) }
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:user) { create(:user) }
|
||||
|
||||
context 'logged in as user with no role' do
|
||||
before :each do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
before :each do
|
||||
get :new
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
before :each do
|
||||
get :index
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
it 'does not create new organization' do
|
||||
expected = expect do
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
end
|
||||
expected.to_not change(Organization, :count)
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PATCH #update' do
|
||||
it 'does not update and redirects to root' do
|
||||
old_name = organization.name
|
||||
patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: 'new name') }
|
||||
|
||||
organization.reload
|
||||
expect(organization.name).to eq(old_name)
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
context 'for a valid organization' do
|
||||
it 'does not destroy a resource' do
|
||||
expected = expect do
|
||||
delete :destroy, params: { id: organization.id }
|
||||
end
|
||||
expected.to_not change(Organization, :count)
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
delete :destroy, params: { id: organization.id }
|
||||
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'logged in as admin' do
|
||||
before :each do
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
before do
|
||||
get :new
|
||||
end
|
||||
it { expect(response).to render_template('new') }
|
||||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
before do
|
||||
get :index
|
||||
end
|
||||
it { expect(response).to render_template('index') }
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'with valid attributes' do
|
||||
it 'creates new organization' do
|
||||
expected = expect do
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
end
|
||||
expected.to change { Organization.count }.by(1)
|
||||
end
|
||||
|
||||
it 'redirects to index' do
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
|
||||
expect(flash[:notice]).to eq('Organization successfully created')
|
||||
expect(response).to redirect_to(admin_organizations_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid attributes' do
|
||||
it 'does not create new organization' do
|
||||
expected = expect do
|
||||
post :create, params: { organization: attributes_for(:organization, name: '') }
|
||||
end
|
||||
expected.to_not change(Organization, :count)
|
||||
end
|
||||
|
||||
it 'redirects to new' do
|
||||
post :create, params: { organization: attributes_for(:organization, name: '') }
|
||||
|
||||
expect(flash[:error]).to eq("Name can't be blank")
|
||||
expect(response).to redirect_to(new_admin_organization_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PATCH #update' do
|
||||
it 'saves and redirects to index when the attributes are valid' do
|
||||
patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: 'changed name') }
|
||||
|
||||
organization.reload
|
||||
expect(organization.name).to eq('changed name')
|
||||
expect(flash[:notice]).to eq('Organization successfully updated')
|
||||
expect(response).to redirect_to(admin_organizations_path)
|
||||
end
|
||||
|
||||
it 'redirects to edit when attributes are invalid' do
|
||||
patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: '') }
|
||||
|
||||
expect(flash[:error]).to eq("Name can't be blank")
|
||||
expect(response).to redirect_to(edit_admin_organization_path(organization))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
context 'for a valid organization' do
|
||||
it 'should successfully destroy a resource' do
|
||||
expected = expect do
|
||||
delete :destroy, params: { id: organization.id }
|
||||
end
|
||||
expected.to change { Organization.count }.by(-1)
|
||||
end
|
||||
|
||||
it 'redirects to index' do
|
||||
delete :destroy, params: { id: organization.id }
|
||||
|
||||
expect(flash[:notice]).to eq('Organization successfully destroyed')
|
||||
expect(response).to redirect_to(admin_organizations_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #assign_org_admins' do
|
||||
let(:org_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
|
||||
before do
|
||||
post :assign_org_admins, params: { id: organization.id,
|
||||
user: { email: user.email } }
|
||||
end
|
||||
|
||||
it 'assigns organization_admin role' do
|
||||
expect(user.roles).to eq [org_admin_role]
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #unassign_org_admins' do
|
||||
let(:org_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
let!(:org_admin_user) { create(:user, role_ids: [org_admin_role.id]) }
|
||||
|
||||
before do
|
||||
delete :unassign_org_admins, params: { id: organization.id,
|
||||
user: { email: org_admin_user.email } }
|
||||
end
|
||||
|
||||
it 'unassigns organization_admin role' do
|
||||
expect(org_admin_user.reload.roles).to eq []
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe OrganizationsController do
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:conference) do
|
||||
create(
|
||||
:conference,
|
||||
splashpage: create(:splashpage, public: true),
|
||||
venue: create(:venue),
|
||||
organization: organization
|
||||
)
|
||||
end
|
||||
let!(:antiquated_conference) do
|
||||
create(
|
||||
:conference,
|
||||
splashpage: create(:splashpage, public: true),
|
||||
venue: create(:venue),
|
||||
organization: organization,
|
||||
start_date: 2.weeks.ago,
|
||||
end_date: 1.week.ago
|
||||
)
|
||||
end
|
||||
|
||||
let!(:other_conference) { create(:conference) }
|
||||
let!(:user) { create(:user) }
|
||||
|
||||
describe 'GET #index' do
|
||||
before :each do
|
||||
sign_in user
|
||||
get :index
|
||||
end
|
||||
|
||||
it { expect(response).to render_template('index') }
|
||||
end
|
||||
|
||||
describe 'GET #conferences' do
|
||||
before :each do
|
||||
get :conferences, params: { id: organization.id }
|
||||
end
|
||||
|
||||
it 'loads the organization' do
|
||||
expect(assigns(:organization)).to eq organization
|
||||
end
|
||||
|
||||
it 'includes organization conferences' do
|
||||
expect(assigns(:current)).to include conference
|
||||
end
|
||||
|
||||
it 'does not include conferences outside organization' do
|
||||
expect(assigns(:current)).not_to include other_conference
|
||||
expect(assigns(:antiquated)).not_to include other_conference
|
||||
end
|
||||
|
||||
it 'includes antiquated organization conferences' do
|
||||
expect(assigns(:antiquated)).to include antiquated_conference
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -14,7 +14,6 @@ FactoryBot.define do
|
|||
registration_limit { 0 }
|
||||
ticket_layout { 'portrait' }
|
||||
description { Faker::Hipster.paragraph }
|
||||
organization
|
||||
after(:create) do |conference|
|
||||
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
|
||||
Role.where(name: 'cfp', resource: conference).first_or_create(description: 'For the members of the CfP team')
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :organization do
|
||||
sequence(:name) { |n| "#{Faker::Company.name} #{n}" }
|
||||
description { Faker::Lorem.paragraph }
|
||||
|
||||
# after(:create) do |organization|
|
||||
# File.open("spec/support/logos/#{1 + rand(13)}.png") do |file|
|
||||
# organization.picture = file
|
||||
# end
|
||||
# organization.save!
|
||||
# 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(: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')
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ describe ApplicationHelper, type: :helper do
|
|||
ENV.delete('OSEM_NAME')
|
||||
expect(nav_root_link_for(nil)).to match 'OSEM'
|
||||
end
|
||||
|
||||
it 'should use the conference organization name' do
|
||||
expect(nav_root_link_for(conference)).to match h(conference.organization.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Organization do
|
||||
let(:organization) { create(:organization) }
|
||||
|
||||
describe 'validation' do
|
||||
it 'is not valid without a name' do
|
||||
should validate_presence_of(:name)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { should have_many(:conferences).dependent(:destroy) }
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue