Sha256: a0d6be579bcd4331967d53c3ebda1827210c9b0997089fcfb76dde9ed43b1538

Contents?: true

Size: 436 Bytes

Versions: 9

Compression:

Stored size: 436 Bytes

Contents

# frozen_string_literal: true

RSpec::Matchers.define :permit do |action|
  match do |policy|
    policy.public_send("#{action}?")
  end

  failure_message do |policy|
    "#{policy.class} does not permit #{action} on #{policy.record} "\
    "for #{policy.user.inspect}."
  end

  failure_message_when_negated do |policy|
    "#{policy.class} does not forbid #{action} on #{policy.record} "\
    "for #{policy.user.inspect}."
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
archangel-0.4.0 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.3.0 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.8 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.7 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.6 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.5 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.4 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.3 lib/archangel/testing_support/matchers/pundit.rb
archangel-0.0.2 lib/archangel/testing_support/matchers/pundit.rb