ability to track resources used in conference
This commit is contained in:
parent
945b4aac60
commit
3065766da9
17 changed files with 281 additions and 2 deletions
61
spec/features/resource_spec.rb
Normal file
61
spec/features/resource_spec.rb
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature Resource do
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:admin) { create(:admin) }
|
||||
let!(:resource) { create(:resource, conference: conference) }
|
||||
|
||||
context 'as an admin' do
|
||||
before(:each) do
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
scenario 'create a new resource' do
|
||||
visit admin_conference_resources_path(conference.short_title)
|
||||
click_link 'Add Resource'
|
||||
|
||||
fill_in 'resource_name', with: 'shirts'
|
||||
fill_in 'resource_description', with: 'what you love to wear!'
|
||||
fill_in 'resource_quantity', with: 10
|
||||
|
||||
click_button 'Create Resource'
|
||||
|
||||
expect(Resource.count).to eq(2)
|
||||
expect(flash).to eq('Resource successfully created.')
|
||||
end
|
||||
|
||||
scenario 'edit an existing resource' do
|
||||
visit admin_conference_resources_path(conference.short_title)
|
||||
click_link('Edit', edit_admin_conference_resource_path(conference.short_title, resource.id))
|
||||
|
||||
fill_in 'resource_name', with: 'changed_name'
|
||||
|
||||
click_button 'Update Resource'
|
||||
resource.reload
|
||||
|
||||
expect(flash).to eq('Resource successfully updated.')
|
||||
expect(resource.name).to eq('changed_name')
|
||||
end
|
||||
|
||||
scenario 'destroy a resource' do
|
||||
visit admin_conference_resources_path(conference.short_title)
|
||||
click_link('Delete', href: admin_conference_resource_path(conference.short_title, resource.id))
|
||||
|
||||
expect(flash).to eq('Resource successfully destroyed.')
|
||||
end
|
||||
|
||||
context 'on admin/resources#index' do
|
||||
|
||||
scenario 'update an existing resource' do
|
||||
visit admin_conference_resources_path(conference.short_title)
|
||||
fill_in 'resource_used', with: 7
|
||||
|
||||
click_button 'Save'
|
||||
resource.reload
|
||||
|
||||
expect(flash).to eq('Resource successfully updated.')
|
||||
expect(resource.used).to eq(7)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue