Merge pull request #1261 from shlok007/resources
Ability to track resources
This commit is contained in:
commit
f42e4adc45
17 changed files with 265 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ describe 'User' do
|
|||
|
||||
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, cfp: create(:cfp)) }
|
||||
|
|
@ -235,6 +235,8 @@ describe 'User' do
|
|||
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)}
|
||||
|
||||
%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)) }
|
||||
|
|
@ -304,6 +306,11 @@ describe 'User' do
|
|||
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_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'cfp'
|
||||
end
|
||||
|
|
@ -366,6 +373,11 @@ describe 'User' do
|
|||
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_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'info_desk'
|
||||
end
|
||||
|
|
@ -427,6 +439,12 @@ describe 'User' do
|
|||
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 be_able to :manage Vposition'
|
||||
it 'should be_able to :manage Vday'
|
||||
|
||||
|
|
|
|||
15
spec/models/resource_spec.rb
Normal file
15
spec/models/resource_spec.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Resource do
|
||||
let(:conference) { create(:conference) }
|
||||
let(:resource) { create :resource }
|
||||
|
||||
it 'has a valid factory' do
|
||||
expect(build(:resource)).to be_valid
|
||||
end
|
||||
|
||||
it 'is not valid with used greater than quantity' do
|
||||
resource.used = resource.quantity + 1
|
||||
expect(resource.valid?).to eq false
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue