Add HomePolicy
This commit is contained in:
parent
10655cf2f7
commit
8f6ad2ad92
4 changed files with 27 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
skip_after_action :verify_authorized
|
|
||||||
|
|
||||||
# GET /
|
# GET /
|
||||||
def show; end
|
def show
|
||||||
|
authorize :home
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
7
app/policies/home_policy.rb
Normal file
7
app/policies/home_policy.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class HomePolicy < ApplicationPolicy
|
||||||
|
def show?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
7
spec/policies/home_policy_spec.rb
Normal file
7
spec/policies/home_policy_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe HomePolicy do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -3,11 +3,18 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe 'GET /' do
|
RSpec.describe 'GET /' do
|
||||||
before do
|
def make_request
|
||||||
get '/'
|
get '/'
|
||||||
end
|
end
|
||||||
|
|
||||||
specify do
|
before do
|
||||||
expect(response).to have_http_status :ok
|
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
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue