Browse Source

Authenticate user for index orgs page (#629)

* Authenticate user for index orgs page

* add spec
pull/630/head v0.1.14
kosiakkatrina 3 years ago committed by GitHub
parent
commit
44fafc02c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/controllers/organisations_controller.rb
  2. 5
      spec/requests/organisations_controller_spec.rb

2
app/controllers/organisations_controller.rb

@ -3,7 +3,7 @@ class OrganisationsController < ApplicationController
include Modules::CaseLogsFilter include Modules::CaseLogsFilter
include Modules::SearchFilter include Modules::SearchFilter
before_action :authenticate_user!, except: [:index] before_action :authenticate_user!
before_action :find_resource, except: [:index] before_action :find_resource, except: [:index]
before_action :authenticate_scope! before_action :authenticate_scope!

5
spec/requests/organisations_controller_spec.rb

@ -25,6 +25,11 @@ RSpec.describe OrganisationsController, type: :request do
get "/organisations/#{organisation.id}/users", headers: headers, params: {} get "/organisations/#{organisation.id}/users", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in") expect(response).to redirect_to("/account/sign-in")
end end
it "does not let you see organisations list" do
get "/organisations", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
end
end end
end end

Loading…
Cancel
Save