Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/policies/person_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class PersonPolicy < ApplicationPolicy
# See https://actionpolicy.evilmartians.io/#/writing_policies

def index?
admin?
authenticated?
end

def show?
Expand All @@ -26,7 +26,7 @@ def destroy?
end

def search?
admin?
authenticated?
end

# Scoping
Expand Down
2 changes: 1 addition & 1 deletion spec/policies/person_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def policy_for(record: nil, user:)
context "with regular user" do
subject { policy_for(user: regular_user) }

it { is_expected.not_to be_allowed_to(:index?) }
it { is_expected.to be_allowed_to(:index?) }
end

context "with no user" do
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/people_authorization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
context "as a regular user" do
before { sign_in regular_user }

it "redirects to root" do
it "renders successfully" do
get people_path
expect(response).to redirect_to(root_path)
expect(response).to have_http_status(:ok)
end
end

Expand Down
Loading