diff options
| author | Alban Peignier | 2017-12-20 22:01:09 +0100 |
|---|---|---|
| committer | Alban Peignier | 2017-12-20 22:01:09 +0100 |
| commit | 1baebfe532dc31ed45c9275fed77c8975dfa169d (patch) | |
| tree | c681ece6b7ea0c9067b1a6e7dcbb230e6e6694b0 | |
| parent | 73d50742ca2e6c2f5e946f97bdb6aea5c7142112 (diff) | |
| download | chouette-core-1baebfe532dc31ed45c9275fed77c8975dfa169d.tar.bz2 | |
Complete ReferentialVehicleJourneysController spec to test optional feature. Refs #5341
| -rw-r--r-- | spec/controllers/referential_vehicle_journeys_controller_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/referential_vehicle_journeys_controller_spec.rb b/spec/controllers/referential_vehicle_journeys_controller_spec.rb index 4402808a3..842a6665e 100644 --- a/spec/controllers/referential_vehicle_journeys_controller_spec.rb +++ b/spec/controllers/referential_vehicle_journeys_controller_spec.rb @@ -3,12 +3,24 @@ require "rails_helper" RSpec.describe ReferentialVehicleJourneysController, type: :controller do login_user + before do + @user.organisation.update features: %w{referential_vehicle_journeys} + end + describe 'GET #index' do it 'should be successful' do get :index, referential_id: referential expect(response).to be_success end + it "refuse access when organisation does not have the feature 'referential_vehicle_journeys'" do + @user.organisation.update features: [] + + expect do + get :index, referential_id: referential + end.to raise_error(FeatureChecker::NotAuthorizedError) + end + it 'define Ransack search (alias @q)' do get :index, referential_id: referential expect(assigns[:q]).to be_an_instance_of(Ransack::Search) |
