* Add comment for public controllers * Add block policy and specs * Add policy for authorizing dashboard * Add follow policy and specs * Refactor a tiny bit * Prevent banned users from following anything * Add a note for email sub controller about auth * Add image upload policies * Add policy for github repos * Fix typo and use correct github repo variable * Fix image uploader and use regular params * Add authenticate_user before action back in * Rename test * Update slack bot message formatting and fix reported URL
23 lines
535 B
Ruby
23 lines
535 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe FollowPolicy do
|
|
subject { described_class.new(user, Follow) }
|
|
|
|
context "when user is not signed in" do
|
|
let(:user) { nil }
|
|
|
|
it { within_block_is_expected.to raise_error(Pundit::NotAuthorizedError) }
|
|
end
|
|
|
|
context "when user is signed in" do
|
|
let(:user) { build(:user) }
|
|
|
|
it { is_expected.to permit_actions(%i[create]) }
|
|
|
|
context "when user is banned" do
|
|
let(:user) { build(:user, :banned) }
|
|
|
|
it { is_expected.to forbid_actions(%i[create]) }
|
|
end
|
|
end
|
|
end
|