1
0
Fork 0

Add HomePolicy

This commit is contained in:
Alex Kotov 2019-03-27 08:04:14 +05:00
parent 10655cf2f7
commit 8f6ad2ad92
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 27 additions and 6 deletions

View file

@ -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

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class HomePolicy < ApplicationPolicy
def show?
true
end
end

View 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

View file

@ -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