Sha256: 745edffceb14955bd3217082b508491b82939a4dca858048fd44ddb37ceea6f7

Contents?: true

Size: 513 Bytes

Versions: 7

Compression:

Stored size: 513 Bytes

Contents

require "spec_helper"

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
pundit-2.0.1 spec/policies/post_policy_spec.rb
pundit-2.0.0 spec/policies/post_policy_spec.rb
pundit-2.0.0.beta1 spec/policies/post_policy_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/pundit-1.1.0/spec/policies/post_policy_spec.rb
pundit-1.1.0 spec/policies/post_policy_spec.rb
pundit-1.0.1 spec/policies/post_policy_spec.rb
pundit-1.0.0 spec/policies/post_policy_spec.rb