Sha256: 95b2918912cee67436712fdc4c950ad31d6fa7ab6bc31c4475cb6e658f7cad24

Contents?: true

Size: 550 Bytes

Versions: 7

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe PostPolicy do
  let(:user) { double }
  let(:own_post) { double(user: user) }
  let(:other_post) { double(user: double) }
  subject { described_class }

  permissions :update?, :show? do
    it "is successful when all permissions match" do
      should permit(user, own_post)
    end

    it "fails when any permissions do not match" do
      expect do
        should permit(user, other_post)
      end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/pundit-2.2.0/spec/policies/post_policy_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/pundit-2.2.0/spec/policies/post_policy_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/pundit-2.2.0/spec/policies/post_policy_spec.rb
pundit-2.3.1 spec/policies/post_policy_spec.rb
pundit-2.3.0 spec/policies/post_policy_spec.rb
pundit-2.2.0 spec/policies/post_policy_spec.rb
pundit-2.1.1 spec/policies/post_policy_spec.rb