Drop knapsack

It constantly fails with "Mysql2::Error: This connection is in use by...".
Might be because of database cleaner? But until we can get this stable,
rip it out again.

Replaced by a matrix based on test type
This commit is contained in:
Henne Vogelsang 2018-09-19 22:06:42 +02:00
parent da91ff8371
commit a0b79c7789
10 changed files with 24 additions and 692 deletions

View file

@ -305,7 +305,7 @@ Layout/SpaceInsideBlockBraces:
- 'spec/controllers/admin/event_schedules_controller_spec.rb'
- 'spec/controllers/admin/schedules_controller_spec.rb'
- 'spec/features/splashpage_spec.rb'
- 'spec/models/ability_spec.rb'
- 'spec/ability/ability_spec.rb'
- 'spec/models/user_spec.rb'
# Offense count: 39
@ -528,7 +528,7 @@ RSpec/ContextWording:
# Offense count: 4
RSpec/DescribeClass:
Exclude:
- 'spec/models/ability_spec.rb'
- 'spec/ability/ability_spec.rb'
- 'spec/models/admin_ability_spec.rb'
- 'spec/models/booth_spec.rb'
- 'spec/models/registration_spec.rb'
@ -588,7 +588,7 @@ RSpec/EmptyLineAfterHook:
# Cop supports --auto-correct.
RSpec/EmptyLineAfterSubject:
Exclude:
- 'spec/models/ability_spec.rb'
- 'spec/ability/ability_spec.rb'
- 'spec/models/admin_ability_spec.rb'
- 'spec/models/booth_spec.rb'
- 'spec/models/cfp_spec.rb'
@ -669,7 +669,7 @@ RSpec/ImplicitExpect:
# SupportedStyles: single_line_only, disallow
RSpec/ImplicitSubject:
Exclude:
- 'spec/models/ability_spec.rb'
- 'spec/ability/ability_spec.rb'
- 'spec/models/admin_ability_spec.rb'
- 'spec/models/booth_spec.rb'
- 'spec/models/campaign_spec.rb'
@ -692,7 +692,7 @@ RSpec/InstanceVariable:
# Cop supports --auto-correct.
RSpec/LeadingSubject:
Exclude:
- 'spec/models/ability_spec.rb'
- 'spec/ability/ability_spec.rb'
- 'spec/models/admin_ability_spec.rb'
- 'spec/models/conference_spec.rb'
- 'spec/models/ticket_spec.rb'
@ -771,7 +771,7 @@ RSpec/ReturnFromStub:
# Offense count: 49
RSpec/ScatteredLet:
Exclude:
- 'spec/models/ability_spec.rb'
- 'spec/ability/ability_spec.rb'
- 'spec/models/admin_ability_spec.rb'
- 'spec/models/payment_spec.rb'

View file

@ -30,8 +30,6 @@ script:
- "./travis_script.sh $TEST_SUITE"
env:
global:
- CI_NODE_TOTAL=4
- TEST_SUITE=rspec
- OSEM_DB_ADAPTER=mysql2
- OSEM_DB_USER=root
- OSEM_DB_PASSWORD=''
@ -39,10 +37,11 @@ env:
- OSEM_DB_PORT=''
- OSEM_DB_NAME='osem_test'
matrix:
- TEST_SUITE=ability
- TEST_SUITE=features
- TEST_SUITE=linters
- CI_NODE_INDEX=0
- CI_NODE_INDEX=1
- CI_NODE_INDEX=2
- CI_NODE_INDEX=3
- TEST_SUITE=models
- TEST_SUITE=controllers
- TEST_SUITE=rest
matrix:
fast_finish: true

View file

@ -275,8 +275,6 @@ group :test do
gem 'rails-controller-testing'
# For managing the environment
gem 'climate_control'
# parallel tests
gem 'knapsack'
end
group :development, :test do

View file

@ -251,8 +251,6 @@ GEM
json-schema (2.8.0)
addressable (>= 2.4)
jwt (1.5.6)
knapsack (1.16.0)
rake
launchy (2.4.2)
addressable (~> 2.3)
leaflet-rails (1.3.1)
@ -639,7 +637,6 @@ DEPENDENCIES
jquery-rails
jquery-ui-rails (~> 4.2.1)
json-schema
knapsack
leaflet-rails
letter_opener
letter_opener_web

View file

@ -7,5 +7,3 @@
require File.expand_path('../config/application', __FILE__)
Osem::Application.load_tasks
Knapsack.load_tasks if defined?(Knapsack)

View file

@ -1,115 +0,0 @@
{
"spec/models/registration_spec.rb": 3.216578483581543,
"spec/controllers/admin/ticket_scannings_controller_spec.rb": 0.5347998142242432,
"spec/controllers/api/v1/speakers_controller_spec.rb": 0.883955717086792,
"spec/models/cfp_spec.rb": 1.714848518371582,
"spec/features/versions_spec.rb": 56.760108947753906,
"spec/features/organizer_ability_spec.rb": 10.754348516464233,
"spec/features/organization_spec.rb": 4.349282264709473,
"spec/models/ability_spec.rb": 39.79845595359802,
"spec/features/sponsor_spec.rb": 2.3821427822113037,
"spec/features/commercials_spec.rb": 11.096951484680176,
"spec/helpers/date_time_helper_spec.rb": 0.008153438568115234,
"spec/models/ticket_spec.rb": 2.12540340423584,
"spec/features/registration_periods_spec.rb": 1.8566482067108154,
"spec/controllers/admin/booths_controller_spec.rb": 2.1381421089172363,
"spec/features/rooms_spec.rb": 3.3080310821533203,
"spec/models/schedule_spec.rb": 0.0045070648193359375,
"spec/features/event_types_spec.rb": 0.76450514793396,
"spec/models/conference_spec.rb": 20.320730209350586,
"spec/models/track_spec.rb": 13.991943836212158,
"spec/controllers/conference_registration_controller_spec.rb": 13.657230854034424,
"spec/controllers/users_controller_spec.rb": 0.39937448501586914,
"spec/models/payment_spec.rb": 1.2693791389465332,
"spec/helpers/format_helper_spec.rb": 0.0015518665313720703,
"spec/controllers/physical_ticket_controller_spec.rb": 0.14853787422180176,
"spec/models/program_spec.rb": 5.236976623535156,
"spec/controllers/admin/roles_controller_spec.rb": 1.2742409706115723,
"spec/serializers/room_serializer_spec.rb": 0.005628347396850586,
"spec/controllers/conferences_controller_spec.rb": 0.3906528949737549,
"spec/features/conference_registration_spec.rb": 4.902153015136719,
"spec/features/campaign_spec.rb": 2.423008918762207,
"spec/models/ticket_scanning_spec.rb": 0.09727764129638672,
"spec/controllers/booths_controller_spec.rb": 1.8176827430725098,
"spec/models/ticket_purchase_spec.rb": 0.756523609161377,
"spec/models/sponsor_spec.rb": 0.06131911277770996,
"spec/features/code_of_conduct_spec.rb": 6.754149675369263,
"spec/features/roles_spec.rb": 11.51219367980957,
"spec/models/admin_ability_spec.rb": 651.1406934261322,
"spec/controllers/application_controller_spec.rb": 0.16449427604675293,
"spec/helpers/users_helper_spec.rb": 0.0009031295776367188,
"spec/features/splashpage_spec.rb": 6.503351926803589,
"spec/features/cfp_spec.rb": 4.385206699371338,
"spec/models/role_spec.rb": 0.14975929260253906,
"spec/features/organization_admin_ability_spec.rb": 8.570372819900513,
"spec/models/campaign_spec.rb": 0.49747681617736816,
"spec/features/ticket_purchases_spec.rb": 8.775394678115845,
"spec/features/email_spec.rb": 1.8525207042694092,
"spec/models/physical_ticket_spec.rb": 0.06188058853149414,
"spec/helpers/conference_helper_spec.rb": 0.35794544219970703,
"spec/features/base_controller_spec.rb": 1.0507938861846924,
"spec/features/omniauth_spec.rb": 1.9456074237823486,
"spec/features/track_organizer_ability_spec.rb": 7.0157434940338135,
"spec/features/proposals_spec.rb": 10.35005784034729,
"spec/serializers/conference_serializer_spec.rb": 0.11621999740600586,
"spec/models/comment_spec.rb": 0.011961221694946289,
"spec/features/cfp_ability_spec.rb": 8.337608337402344,
"spec/controllers/api/v1/events_controller_spec.rb": 0.7122371196746826,
"spec/serializers/track_serializer_spec.rb": 0.059462785720825195,
"spec/controllers/schedules_controller_spec.rb": 0.6626288890838623,
"spec/controllers/admin/events_controller_spec.rb": 0.2272028923034668,
"spec/models/email_settings_spec.rb": 0.5617916584014893,
"spec/controllers/admin/event_schedules_controller_spec.rb": 2.14667010307312,
"spec/models/registration_period_spec.rb": 0.5143365859985352,
"spec/models/event_spec.rb": 8.104061126708984,
"spec/controllers/admin/tracks_controller_spec.rb": 8.185055017471313,
"spec/models/booth_spec.rb": 7.238089084625244,
"spec/features/tracks_spec.rb": 15.051470518112183,
"spec/controllers/admin/organizations_controller_spec.rb": 0.7151005268096924,
"spec/features/program_spec.rb": 1.6030263900756836,
"spec/models/commercial_spec.rb": 0.006638050079345703,
"spec/routing/routing_spec.rb": 0.0017058849334716797,
"spec/controllers/tracks_controller_spec.rb": 3.0302350521087646,
"spec/controllers/admin/rooms_controller_spec.rb": 1.7850117683410645,
"spec/models/resource_spec.rb": 0.11144089698791504,
"spec/helpers/application_helper_spec.rb": 2.7778303623199463,
"spec/controllers/api/v1/rooms_controller_spec.rb": 0.1207578182220459,
"spec/features/tickets_spec.rb": 7.62256646156311,
"spec/models/target_spec.rb": 0.7310116291046143,
"spec/helpers/events_helper_spec.rb": 3.576235294342041,
"spec/models/room_spec.rb": 0.046385765075683594,
"spec/features/difficulty_levels_spec.rb": 3.0397679805755615,
"spec/models/event_schedule_spec.rb": 1.4522051811218262,
"spec/features/user_ability_spec.rb": 0.28156256675720215,
"spec/controllers/admin/conferences_controller_spec.rb": 5.404377222061157,
"spec/features/venues_spec.rb": 0.7081923484802246,
"spec/controllers/users/omniauth_callbacks_controller_spec.rb": 0.0032668113708496094,
"spec/controllers/api/v1/tracks_controller_spec.rb": 0.21274399757385254,
"spec/controllers/subscriptions_controller_spec.rb": 0.3864889144897461,
"spec/controllers/admin/sponsorship_levels_controller_spec.rb": 1.7902915477752686,
"spec/controllers/admin/targets_controller_spec.rb": 1.651890754699707,
"spec/features/contact_spec.rb": 1.39925217628479,
"spec/controllers/admin/schedules_controller_spec.rb": 0.5556893348693848,
"spec/serializers/event_serializer_spec.rb": 0.2761070728302002,
"spec/controllers/admin/programs_controller_spec.rb": 0.12646102905273438,
"spec/controllers/admin/versions_controller_spec.rb": 1.8679115772247314,
"spec/models/user_spec.rb": 2.361865997314453,
"spec/controllers/admin/users_controller_spec.rb": 0.5107555389404297,
"spec/models/organization_spec.rb": 0.0039217472076416016,
"spec/controllers/confirmations_controller_spec.rb": 0.05090951919555664,
"spec/controllers/admin/comments_controller_spec.rb": 0.5595676898956299,
"spec/models/event_type_spec.rb": 0.17554306983947754,
"spec/features/lodgings_spec.rb": 6.616101264953613,
"spec/controllers/organizations_controller_spec.rb": 0.967041015625,
"spec/models/sponsorship_level_spec.rb": 0.18370461463928223,
"spec/controllers/proposals_controller_spec.rb": 8.728510618209839,
"spec/mailers/mailbot_spec.rb": 1.2736093997955322,
"spec/features/resource_spec.rb": 0.9196040630340576,
"spec/features/info_desk_ability_spec.rb": 5.8393683433532715,
"spec/features/sponsorship_level_spec.rb": 2.8623433113098145,
"spec/features/conference_spec.rb": 4.4298248291015625,
"spec/controllers/api/v1/conferences_controller_spec.rb": 0.6067855358123779,
"spec/serializers/speaker_serializer_spec.rb": 0.02062392234802246,
"spec/features/volunteers_spec.rb": 3.3659849166870117,
"spec/controllers/admin/registration_periods_controller_spec.rb": 1.344085693359375
}

View file

@ -1,550 +0,0 @@
# frozen_string_literal: true
require 'spec_helper'
require 'cancan/matchers'
describe 'User with admin role' do
describe 'Abilities' do
let!(:admin) { create(:admin) }
# see https://github.com/CanCanCommunity/cancancan/wiki/Testing-Abilities
subject(:ability){ AdminAbility.new(user) }
let(:user){ nil }
let!(:organization) { create(:organization) }
let!(:my_conference) { create(:full_conference, organization: organization) }
let!(:registration_ticket) { create(:registration_ticket, conference: my_conference) }
let(:my_venue) { my_conference.venue || create(:venue, conference: my_conference) }
let(:my_registration) { create(:registration, conference: my_conference, user: admin) }
let(:other_registration) { create(:registration, conference: conference_public) }
let(:my_event) { create(:event_full, program: my_conference.program) }
let(:my_room) { create(:room, venue: my_conference.venue) }
let!(:my_event_scheduled) { create(:event_full, program: my_conference.program, room_id: my_room.id) }
let(:other_event) { create(:event_full, program: conference_public.program) }
let(:conference_not_public) { create(:conference, splashpage: create(:splashpage, public: false)) }
let(:conference_public) { create(:full_conference, splashpage: create(:splashpage, public: true)) }
let(:event_confirmed) { create(:event, state: 'confirmed') }
let(:event_unconfirmed) { create(:event) }
let(:commercial_event_confirmed) { create(:commercial, commercialable: event_confirmed) }
let(:commercial_event_unconfirmed) { create(:commercial, commercialable: event_unconfirmed) }
let(:resource) { create(:resource, conference: my_conference) }
let(:registration) { create(:registration) }
let(:program_with_cfp) { create(:program, :with_cfp) }
let(:program_without_cfp) { create(:program) }
let(:conference_with_open_registration) { create(:conference) }
let!(:open_registration_period) { create(:registration_period, conference: conference_with_open_registration, start_date: Date.current - 6.days) }
let(:conference_with_closed_registration) { create(:conference) }
let!(:closed_registration_period) { create(:registration_period, conference: conference_with_closed_registration, start_date: Date.current - 6.days, end_date: Date.current - 6.days) }
let!(:my_schedule) { create(:schedule, program: my_conference.program) }
let!(:other_schedule) { create(:schedule, program: conference_public.program) }
let!(:my_event_schedule) { create(:event_schedule, schedule: my_schedule) }
let!(:other_event_schedule) { create(:event_schedule, schedule: other_schedule) }
let!(:my_self_organized_track) { create(:track, :self_organized, program: my_conference.program, state: 'confirmed') }
context 'user #is_admin?' do
let(:venue) { my_conference.venue }
let(:room) { create(:room, venue: venue) }
let!(:event) { create(:event_full, program: my_conference.program, room_id: room.id) }
let(:user) { create(:admin) }
it{ should be_able_to(:manage, :all) }
it{ should_not be_able_to(:destroy, my_conference.program) }
it{ should_not be_able_to(:destroy, my_venue) }
end
shared_examples 'user with any role' do
let!(:other_organization) { create(:organization) }
let!(:other_conference) { create(:conference, organization: other_organization) }
it{ should_not be_able_to(:update, Role.find_by(name: 'organization_admin', resource: other_organization)) }
it{ should_not be_able_to(:edit, Role.find_by(name: 'organization_admin', resource: other_organization)) }
it{ should be_able_to(:admins, organization) }
it{ should_not be_able_to(:new, User.new) }
it{ should_not be_able_to(:create, User.new) }
it{ should_not be_able_to(:manage, User) }
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
it{ should_not be_able_to(:toggle_user, Role.find_by(name: role, resource: other_conference)) }
it{ should_not be_able_to(:update, Role.find_by(name: role, resource: other_conference)) }
it{ should_not be_able_to(:edit, Role.find_by(name: role, resource: other_conference)) }
it{ should be_able_to(:show, Role.find_by(name: role, resource: other_conference)) }
it{ should be_able_to(:index, Role.find_by(name: role, resource: other_conference)) }
end
context 'accesses track organizers' do
before :each do
other_self_organized_track = create(:track, :self_organized)
@other_track_organizer_role = Role.where(name: 'track_organizer', resource: other_self_organized_track).first_or_create
end
it{ should_not be_able_to(:toggle_user, @other_track_organizer_role) }
it{ should_not be_able_to(:update, @other_track_organizer_role) }
it{ should_not be_able_to(:edit, @other_track_organizer_role) }
it{ should be_able_to(:show, @other_track_organizer_role) }
it{ should be_able_to(:index, @other_track_organizer_role) }
end
end
shared_examples 'user with non-organizer role' do |role_name|
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
if role == role_name
it{ should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
else
it{ should_not be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
end
it{ should_not be_able_to(:update, Role.find_by(name: role, resource: my_conference)) }
it{ should_not be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
it{ should be_able_to(:show, Role.find_by(name: role, resource: my_conference)) }
it{ should be_able_to(:index, Role.find_by(name: role, resource: my_conference)) }
end
context 'accesses track organizers' do
before :each do
@track_organizer_role = Role.where(name: 'track_organizer', resource: my_self_organized_track).first_or_create
end
if role_name == 'track_organizer'
it{ should be_able_to(:toggle_user, @track_organizer_role) }
else
it{ should_not be_able_to(:toggle_user, @track_organizer_role) }
end
it{ should_not be_able_to(:update, @track_organizer_role) }
it{ should_not be_able_to(:edit, @track_organizer_role) }
it{ should be_able_to(:show, @track_organizer_role) }
it{ should be_able_to(:index, @track_organizer_role) }
end
end
context 'when user has the role organization_admin' do
let(:role) { Role.find_by(name: 'organization_admin', resource: organization) }
let(:user) { create(:user, role_ids: [role.id]) }
let(:other_organization) { create(:organization) }
let(:other_conference) { create(:conference, organization: other_organization) }
it{ should be_able_to(:assign_org_admins, organization) }
it{ should be_able_to(:unassign_org_admins, organization) }
it{ should be_able_to(:manage, my_conference) }
it{ should be_able_to(:read, organization) }
it{ should be_able_to(:update, organization) }
it{ should be_able_to(:destroy, organization) }
it{ should be_able_to(:new, Conference.new) }
it{ should be_able_to(:create, Conference.new(organization_id: organization.id)) }
it{ should_not be_able_to(:manage, other_conference) }
it{ should_not be_able_to(:create, Conference.new(organization_id: other_organization.id)) }
it{ should_not be_able_to(:new, Organization.new) }
it{ should_not be_able_to(:create, Organization.new) }
it_behaves_like 'user with any role'
end
context 'when user has the role organizer' do
let(:role) { Role.find_by(name: 'organizer', resource: my_conference) }
let(:user) { create(:user, role_ids: [role.id]) }
it{ should_not be_able_to(:destroy, my_conference.program) }
it 'when there is a room assigned to an event' do
should_not be_able_to(:destroy, my_venue)
end
it 'when there are no rooms used' do
my_event_scheduled.room_id = nil
my_event_scheduled.save!
my_event_scheduled.reload
should be_able_to(:destroy, my_venue)
end
it{ should_not be_able_to(:new, Organization.new) }
it{ should_not be_able_to(:create, Organization.new) }
it{ should_not be_able_to(:new, Conference.new) }
it{ should_not be_able_to(:create, Conference.new) }
it{ should be_able_to(:read, my_conference) }
it{ should be_able_to(:update, my_conference) }
it{ should be_able_to(:destroy, my_conference) }
it{ should_not be_able_to(:manage, conference_public) }
it{ should be_able_to(:manage, my_conference.splashpage) }
it{ should_not be_able_to(:manage, conference_public.splashpage) }
it{ should be_able_to(:manage, my_conference.contact) }
it{ should_not be_able_to(:manage, conference_public.contact) }
it{ should be_able_to(:manage, my_conference.email_settings) }
it{ should_not be_able_to(:manage, conference_public.email_settings) }
it{ should be_able_to(:manage, my_conference.campaigns.first) }
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
it{ should be_able_to(:manage, my_conference.targets.first) }
it{ should_not be_able_to(:manage, conference_public.targets.first) }
it{ should be_able_to(:manage, my_conference.commercials.first) }
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
it{ should be_able_to(:manage, my_conference.registration_period) }
it{ should_not be_able_to(:manage, conference_public.registration_period) }
it{ should be_able_to(:manage, my_conference.questions.first) }
it{ should_not be_able_to(:manage, conference_public.questions.first) }
it{ should be_able_to(:manage, my_conference.program.cfp) }
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
it{ should be_able_to(:manage, my_schedule) }
it{ should_not be_able_to(:manage, other_schedule) }
it{ should be_able_to(:manage, my_event_schedule) }
it{ should_not be_able_to(:manage, other_event_schedule) }
it{ should be_able_to(:manage, my_conference.venue) }
it{ should_not be_able_to(:manage, conference_public.venue) }
it{ should be_able_to(:manage, my_conference.lodgings.first) }
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
it{ should be_able_to(:manage, my_conference.sponsors.first) }
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
it{ should be_able_to(:manage, my_conference.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
it{ should be_able_to(:manage, my_conference.tickets.first) }
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
it{ should be_able_to(:manage, my_registration) }
it{ should_not be_able_to(:manage, other_registration) }
it{ should be_able_to(:manage, my_event) }
it{ should_not be_able_to(:manage, other_event) }
it{ should be_able_to(:manage, my_event.event_type) }
it{ should_not be_able_to(:manage, other_event.event_type) }
it{ should be_able_to(:manage, my_event.track) }
it{ should_not be_able_to(:manage, other_event.track) }
it{ should be_able_to(:manage, my_event.difficulty_level) }
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
it{ should be_able_to(:manage, my_event.commercials.first) }
it{ should_not be_able_to(:manage, other_event.commercials.first) }
it{ should be_able_to(:index, my_event.comment_threads.first) }
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
it{ should be_able_to(:manage, resource) }
it{ should_not be_able_to(:assign_org_admins, organization) }
it{ should_not be_able_to(:unassign_org_admins, organization) }
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
it{ should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
it{ should be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
it{ should be_able_to(:update, Role.find_by(name: role, resource: my_conference)) }
it{ should be_able_to(:show, Role.find_by(name: role, resource: my_conference)) }
it{ should be_able_to(:index, Role.find_by(name: role, resource: my_conference)) }
end
context 'can manage track organizers' do
before :each do
@track_organizer_role = Role.where(name: 'track_organizer', resource: my_self_organized_track).first_or_create
end
it{ should be_able_to(:toggle_user, @track_organizer_role) }
it{ should be_able_to(:edit, @track_organizer_role) }
it{ should be_able_to(:update, @track_organizer_role) }
it{ should be_able_to(:show, @track_organizer_role) }
it{ should be_able_to(:index, @track_organizer_role) }
end
it_behaves_like 'user with any role'
end
context 'when user has the role cfp' do
let(:role) { Role.find_by(name: 'cfp', resource: my_conference) }
let(:user) { create(:user, role_ids: [role.id]) }
it{ should_not be_able_to(:new, Conference.new) }
it{ should_not be_able_to(:create, Conference.new) }
it{ should_not be_able_to(:manage, my_conference) }
it{ should_not be_able_to(:manage, conference_public) }
it{ should_not be_able_to(:manage, my_conference.splashpage) }
it{ should_not be_able_to(:manage, conference_public.splashpage) }
it{ should_not be_able_to(:manage, my_conference.contact) }
it{ should_not be_able_to(:manage, conference_public.contact) }
it{ should be_able_to(:manage, my_conference.email_settings) }
it{ should_not be_able_to(:manage, conference_public.email_settings) }
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
it{ should_not be_able_to(:manage, my_conference.targets.first) }
it{ should_not be_able_to(:manage, conference_public.targets.first) }
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
it{ should_not be_able_to(:manage, my_conference.registration_period) }
it{ should_not be_able_to(:manage, conference_public.registration_period) }
it{ should_not be_able_to(:manage, my_conference.questions.first) }
it{ should_not be_able_to(:manage, conference_public.questions.first) }
it{ should be_able_to(:manage, my_conference.program.cfp) }
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
it{ should be_able_to(:manage, my_schedule) }
it{ should_not be_able_to(:manage, other_schedule) }
it{ should_not be_able_to(:manage, my_event_schedule) }
it{ should_not be_able_to(:manage, other_event_schedule) }
it{ should_not be_able_to(:manage, my_conference.venue) }
it{ should be_able_to(:show, my_conference.venue) }
it{ should_not be_able_to(:manage, conference_public.venue) }
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
it{ should_not be_able_to(:manage, my_registration) }
it{ should_not be_able_to(:manage, other_registration) }
it{ should be_able_to(:manage, my_event) }
it{ should_not be_able_to(:manage, other_event) }
it{ should be_able_to(:manage, my_event.event_type) }
it{ should_not be_able_to(:manage, other_event.event_type) }
it{ should be_able_to(:manage, my_event.track) }
it{ should_not be_able_to(:manage, other_event.track) }
it{ should be_able_to(:manage, my_event.difficulty_level) }
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
it{ should be_able_to(:manage, my_event.commercials.first) }
it{ should_not be_able_to(:manage, other_event.commercials.first) }
it{ should be_able_to(:index, my_event.comment_threads.first) }
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
it{ should_not be_able_to(:manage, resource) }
it{ should be_able_to(:index, resource) }
it{ should be_able_to(:show, resource) }
it{ should be_able_to(:update, resource) }
it{ should_not be_able_to(:assign_org_admins, organization) }
it{ should_not be_able_to(:unassign_org_admins, organization) }
it_behaves_like 'user with any role'
it_behaves_like 'user with non-organizer role', 'cfp'
end
context 'when user has the role info_desk' do
let(:role) { Role.find_by(name: 'info_desk', resource: my_conference) }
let(:user) { create(:user, role_ids: [role.id]) }
it{ should_not be_able_to(:new, Conference.new) }
it{ should_not be_able_to(:create, Conference.new) }
it{ should_not be_able_to(:manage, my_conference) }
it{ should_not be_able_to(:manage, conference_public) }
it{ should_not be_able_to(:manage, my_conference.splashpage) }
it{ should_not be_able_to(:manage, conference_public.splashpage) }
it{ should_not be_able_to(:manage, my_conference.contact) }
it{ should_not be_able_to(:manage, conference_public.contact) }
it{ should_not be_able_to(:manage, my_conference.email_settings) }
it{ should_not be_able_to(:manage, conference_public.email_settings) }
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
it{ should_not be_able_to(:manage, my_conference.targets.first) }
it{ should_not be_able_to(:manage, conference_public.targets.first) }
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
it{ should_not be_able_to(:manage, my_conference.registration_period) }
it{ should_not be_able_to(:manage, conference_public.registration_period) }
it{ should be_able_to(:manage, my_conference.questions.first) }
it{ should_not be_able_to(:manage, conference_public.questions.first) }
it{ should_not be_able_to(:manage, my_conference.program.cfp) }
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
it{ should_not be_able_to(:manage, my_schedule) }
it{ should_not be_able_to(:manage, other_schedule) }
it{ should_not be_able_to(:manage, my_event_schedule) }
it{ should_not be_able_to(:manage, other_event_schedule) }
it{ should_not be_able_to(:manage, my_conference.venue) }
it{ should_not be_able_to(:show, my_conference.venue) }
it{ should_not be_able_to(:manage, conference_public.venue) }
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
it{ should be_able_to(:manage, my_registration) }
it{ should_not be_able_to(:manage, other_registration) }
it{ should_not be_able_to(:manage, my_event) }
it{ should_not be_able_to(:manage, other_event) }
it{ should_not be_able_to(:manage, my_event.event_type) }
it{ should_not be_able_to(:manage, other_event.event_type) }
it{ should_not be_able_to(:manage, my_event.track) }
it{ should_not be_able_to(:manage, other_event.track) }
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
it{ should_not be_able_to(:manage, my_event.commercials.first) }
it{ should_not be_able_to(:manage, other_event.commercials.first) }
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
it{ should_not be_able_to(:manage, resource) }
it{ should be_able_to(:index, resource) }
it{ should be_able_to(:show, resource) }
it{ should be_able_to(:update, resource) }
it{ should_not be_able_to(:assign_org_admins, organization) }
it{ should_not be_able_to(:unassign_org_admins, organization) }
it_behaves_like 'user with any role'
it_behaves_like 'user with non-organizer role', 'info_desk'
end
context 'when user has the role volunteers_coordinator' do
let(:role) { Role.find_by(name: 'volunteers_coordinator', resource: my_conference) }
let(:user) { create(:user, role_ids: [role.id]) }
it{ should_not be_able_to(:new, Conference.new) }
it{ should_not be_able_to(:create, Conference.new) }
it{ should_not be_able_to(:manage, my_conference) }
it{ should_not be_able_to(:manage, conference_public) }
it{ should_not be_able_to(:manage, my_conference.splashpage) }
it{ should_not be_able_to(:manage, conference_public.splashpage) }
it{ should_not be_able_to(:manage, my_conference.contact) }
it{ should_not be_able_to(:manage, conference_public.contact) }
it{ should_not be_able_to(:manage, my_conference.email_settings) }
it{ should_not be_able_to(:manage, conference_public.email_settings) }
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
it{ should_not be_able_to(:manage, my_conference.targets.first) }
it{ should_not be_able_to(:manage, conference_public.targets.first) }
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
it{ should_not be_able_to(:manage, my_conference.registration_period) }
it{ should_not be_able_to(:manage, conference_public.registration_period) }
it{ should_not be_able_to(:manage, my_conference.questions.first) }
it{ should_not be_able_to(:manage, conference_public.questions.first) }
it{ should_not be_able_to(:manage, my_conference.program.cfp) }
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
it{ should_not be_able_to(:manage, my_schedule) }
it{ should_not be_able_to(:manage, other_schedule) }
it{ should_not be_able_to(:manage, my_event_schedule) }
it{ should_not be_able_to(:manage, other_event_schedule) }
it{ should_not be_able_to(:manage, my_conference.venue) }
it{ should_not be_able_to(:show, my_conference.venue) }
it{ should_not be_able_to(:manage, conference_public.venue) }
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
it{ should_not be_able_to(:manage, registration) }
it{ should_not be_able_to(:manage, other_registration) }
it{ should_not be_able_to(:manage, my_event) }
it{ should_not be_able_to(:manage, other_event) }
it{ should_not be_able_to(:manage, my_event.event_type) }
it{ should_not be_able_to(:manage, other_event.event_type) }
it{ should_not be_able_to(:manage, my_event.track) }
it{ should_not be_able_to(:manage, other_event.track) }
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
it{ should_not be_able_to(:manage, my_event.commercials.first) }
it{ should_not be_able_to(:manage, other_event.commercials.first) }
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
it{ should_not be_able_to(:manage, resource) }
it{ should be_able_to(:index, resource) }
it{ should be_able_to(:show, resource) }
it{ should be_able_to(:update, resource) }
it{ should_not be_able_to(:assign_org_admins, organization) }
it{ should_not be_able_to(:unassign_org_admins, organization) }
it 'should be_able to :manage Vposition'
it 'should be_able to :manage Vday'
it_behaves_like 'user with any role'
it_behaves_like 'user with non-organizer role', 'volunteers_coordinator'
end
context 'when user has the role track_organizer' do
let(:role) { Role.where(name: 'track_organizer', resource: my_self_organized_track).first_or_create }
let(:user) { create(:user, role_ids: [role.id]) }
let(:new_track) { build(:track, program: my_conference.program) }
let(:new_event) { build(:event, program: my_conference.program) }
let(:new_schedule) { build(:schedule, program: my_conference.program) }
let(:new_track_schedule) { build(:schedule, program: my_conference.program, track: new_track) }
let(:my_self_organized_track_event) { create(:event, program: my_conference.program, track: my_self_organized_track) }
let(:my_self_organized_track_event_commercial) { create(:commercial, commercialable: my_self_organized_track_event) }
let(:my_self_organized_track_schedule) { create(:schedule, program: my_conference.program, track: my_self_organized_track) }
let(:my_self_organized_track_event_schedule) { create(:event_schedule, event: my_self_organized_track_event, schedule: my_self_organized_track_schedule, room: my_self_organized_track.room) }
it{ should_not be_able_to(:new, Conference.new) }
it{ should_not be_able_to(:create, Conference.new) }
it{ should_not be_able_to(:manage, my_conference) }
it{ should_not be_able_to(:manage, conference_public) }
it{ should_not be_able_to(:manage, my_conference.splashpage) }
it{ should_not be_able_to(:manage, conference_public.splashpage) }
it{ should_not be_able_to(:manage, my_conference.contact) }
it{ should_not be_able_to(:manage, conference_public.contact) }
it{ should_not be_able_to(:manage, my_conference.email_settings) }
it{ should_not be_able_to(:manage, conference_public.email_settings) }
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
it{ should_not be_able_to(:manage, my_conference.targets.first) }
it{ should_not be_able_to(:manage, conference_public.targets.first) }
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
it{ should_not be_able_to(:manage, my_conference.registration_period) }
it{ should_not be_able_to(:manage, conference_public.registration_period) }
it{ should_not be_able_to(:manage, my_conference.questions.first) }
it{ should_not be_able_to(:manage, conference_public.questions.first) }
it{ should_not be_able_to(:manage, my_conference.program.cfp) }
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
it{ should_not be_able_to(:manage, my_schedule) }
it{ should_not be_able_to(:manage, other_schedule) }
it{ should_not be_able_to(:manage, my_event_schedule) }
it{ should_not be_able_to(:manage, other_event_schedule) }
it{ should_not be_able_to(:manage, my_conference.venue) }
it{ should_not be_able_to(:show, my_conference.venue) }
it{ should_not be_able_to(:manage, conference_public.venue) }
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
it{ should_not be_able_to(:manage, registration) }
it{ should_not be_able_to(:manage, other_registration) }
it{ should_not be_able_to(:manage, my_event) }
it{ should_not be_able_to(:manage, other_event) }
it{ should_not be_able_to(:manage, my_event.event_type) }
it{ should_not be_able_to(:manage, other_event.event_type) }
it{ should_not be_able_to(:manage, my_event.track) }
it{ should_not be_able_to(:manage, other_event.track) }
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
it{ should_not be_able_to(:manage, my_event.commercials.first) }
it{ should_not be_able_to(:manage, other_event.commercials.first) }
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
it{ should_not be_able_to(:manage, resource) }
it{ should be_able_to(:show, my_conference.program) }
it{ should be_able_to(:update, new_track) }
it{ should be_able_to(:manage, my_self_organized_track) }
it{ should_not be_able_to(:edit, my_self_organized_track) }
it{ should_not be_able_to(:update, my_self_organized_track) }
it{ should_not be_able_to(:assign_org_admins, organization) }
it{ should_not be_able_to(:unassign_org_admins, organization) }
it{ should be_able_to(:update, new_event) }
it{ should be_able_to(:manage, my_self_organized_track_event) }
it{ should be_able_to(:manage, my_self_organized_track_event_commercial) }
it{ should be_able_to(:update, new_schedule) }
it{ should be_able_to(:new, new_track_schedule) }
it{ should be_able_to(:manage, my_self_organized_track_schedule) }
it{ should be_able_to(:manage, my_self_organized_track_event_schedule) }
it_behaves_like 'user with any role'
it_behaves_like 'user with non-organizer role', 'track_organizer'
end
end
end

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'knapsack'
require 'simplecov'
if ENV['TRAVIS']
@ -103,4 +102,3 @@ RSpec.configure do |config|
end
OmniAuth.config.test_mode = true
Knapsack::Adapters::RSpecAdapter.bind

View file

@ -16,12 +16,19 @@ case $TEST_SUITE in
bundle exec rubocop -Dc .rubocop.yml
bundle exec haml-lint app/views
;;
rspec)
bundle exec rake "knapsack:rspec[--color --format documentation]"
models)
bundle exec rspec --format documentation spec/models
;;
*)
bundle exec rubocop -Dc .rubocop.yml
bundle exec haml-lint app/views
bundle exec rspec --color --format documentation
features)
bundle exec rspec --format documentation spec/features
;;
controllers)
bundle exec rspec --format documentation spec/controllers
;;
ability)
bundle exec rspec --format documentation spec/ability
;;
rest)
bundle exec rspec --format documentation --exclude-pattern "spec/{models,features,controllers,ability}/**/*_spec.rb"
;;
esac