diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 024cea9..d3f0433 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true class HomeController < ApplicationController - skip_after_action :verify_authorized - # GET / - def show; end + def show + authorize :home + end end diff --git a/app/policies/home_policy.rb b/app/policies/home_policy.rb new file mode 100644 index 0000000..e19333d --- /dev/null +++ b/app/policies/home_policy.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class HomePolicy < ApplicationPolicy + def show? + true + end +end diff --git a/spec/policies/home_policy_spec.rb b/spec/policies/home_policy_spec.rb new file mode 100644 index 0000000..8fec526 --- /dev/null +++ b/spec/policies/home_policy_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe HomePolicy do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/root_spec.rb b/spec/requests/root_spec.rb index 6919efb..a5a1681 100644 --- a/spec/requests/root_spec.rb +++ b/spec/requests/root_spec.rb @@ -3,11 +3,18 @@ require 'rails_helper' RSpec.describe 'GET /' do - before do + def make_request get '/' end - specify do - expect(response).to have_http_status :ok + before do + sign_in current_account.user if current_account&.user + make_request + end + + for_account_types nil, :guest, :usual, :superuser do + specify do + expect(response).to have_http_status :ok + end end end