This repository has been archived by the owner on Jul 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #416 - add tests for Reservation actions (creation, equipment handling, renewal) - add tests for Rails Admin routes - resolve issue with renewals (see #1218) - add numerous helpers for integration tests - misc cleanup of other tests - resolve deprecation warning reintroduced by #1081
- Loading branch information
Showing
11 changed files
with
559 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Equipment model views' do | ||
before(:each) { app_setup } | ||
subject { page } | ||
|
||
context 'index view' do | ||
before { visit equipment_models_path } | ||
it { is_expected.to have_content('Equipment Models') } | ||
it { is_expected.to have_content(@eq_model.name) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Active Admin', type: :feature do | ||
before(:all) { app_setup } | ||
|
||
context 'as superuser' do | ||
before { sign_in_as_user(@superuser) } | ||
after { sign_out } | ||
|
||
shared_examples 'can access route' do |model| | ||
let(:path) do | ||
admin_routes.index_url(model_name: model, host: Capybara.default_host) | ||
end | ||
|
||
it do | ||
visit path | ||
expect(page.current_url).to eq(path) | ||
end | ||
end | ||
|
||
it 'can access the dashboard' do | ||
visit admin_routes.dashboard_path | ||
expect(page).to have_content 'Site Administration' | ||
expect(page.current_url).to \ | ||
eq(admin_routes.dashboard_url(host: Capybara.default_host)) | ||
end | ||
|
||
it_behaves_like 'can access route', :announcement | ||
it_behaves_like 'can access route', :app_config | ||
it_behaves_like 'can access route', :blackout | ||
it_behaves_like 'can access route', :category | ||
it_behaves_like 'can access route', :checkin_procedure | ||
it_behaves_like 'can access route', :checkout_procedure | ||
it_behaves_like 'can access route', :equipment_item | ||
it_behaves_like 'can access route', :equipment_model | ||
it_behaves_like 'can access route', :requirement | ||
it_behaves_like 'can access route', :reservation | ||
it_behaves_like 'can access route', :user | ||
end | ||
|
||
context 'as other roles' do | ||
shared_examples 'cannot access route' do |model| | ||
if model | ||
let(:path) { admin_routes.index_path(model_name: model) } | ||
else | ||
let(:path) { admin_routes.dashboard_path } | ||
end | ||
|
||
it do | ||
visit path | ||
expect(page.current_url).to eq(root_url(host: Capybara.default_host)) | ||
end | ||
end | ||
|
||
context 'as patron' do | ||
before { sign_in_as_user(@user) } | ||
after { sign_out } | ||
|
||
it_behaves_like 'cannot access route' | ||
it_behaves_like 'cannot access route', :announcement | ||
it_behaves_like 'cannot access route', :app_config | ||
it_behaves_like 'cannot access route', :blackout | ||
it_behaves_like 'cannot access route', :category | ||
it_behaves_like 'cannot access route', :checkin_procedure | ||
it_behaves_like 'cannot access route', :checkout_procedure | ||
it_behaves_like 'cannot access route', :equipment_item | ||
it_behaves_like 'cannot access route', :equipment_model | ||
it_behaves_like 'cannot access route', :requirement | ||
it_behaves_like 'cannot access route', :reservation | ||
it_behaves_like 'cannot access route', :user | ||
end | ||
|
||
context 'as checkout person' do | ||
before { sign_in_as_user(@checkout_person) } | ||
after { sign_out } | ||
|
||
it_behaves_like 'cannot access route' | ||
it_behaves_like 'cannot access route', :announcement | ||
it_behaves_like 'cannot access route', :app_config | ||
it_behaves_like 'cannot access route', :blackout | ||
it_behaves_like 'cannot access route', :category | ||
it_behaves_like 'cannot access route', :checkin_procedure | ||
it_behaves_like 'cannot access route', :checkout_procedure | ||
it_behaves_like 'cannot access route', :equipment_item | ||
it_behaves_like 'cannot access route', :equipment_model | ||
it_behaves_like 'cannot access route', :requirement | ||
it_behaves_like 'cannot access route', :reservation | ||
it_behaves_like 'cannot access route', :user | ||
end | ||
|
||
context 'as admin' do | ||
before { sign_in_as_user(@admin) } | ||
after { sign_out } | ||
|
||
it_behaves_like 'cannot access route' | ||
it_behaves_like 'cannot access route', :announcement | ||
it_behaves_like 'cannot access route', :app_config | ||
it_behaves_like 'cannot access route', :blackout | ||
it_behaves_like 'cannot access route', :category | ||
it_behaves_like 'cannot access route', :checkin_procedure | ||
it_behaves_like 'cannot access route', :checkout_procedure | ||
it_behaves_like 'cannot access route', :equipment_item | ||
it_behaves_like 'cannot access route', :equipment_model | ||
it_behaves_like 'cannot access route', :requirement | ||
it_behaves_like 'cannot access route', :reservation | ||
it_behaves_like 'cannot access route', :user | ||
end | ||
end | ||
end |
Oops, something went wrong.