Sha256: 0d8331448d81b84b7ceab6a2ca5ecfee5c7fe15c38e698b88b22bf0054a3ee11

Contents?: true

Size: 959 Bytes

Versions: 13

Compression:

Stored size: 959 Bytes

Contents

RSpec::Matchers.define :be_permitted_to do |*args|

  def supports_block_expectations?
    true
  end

  failure_message do |actual|
    "expected that #{ actual.class.name } would be permitted to #{ expected.first } #{ expected.second }"
  end
  match do |policy|
    policy.permit?( *args )
  end
end

RSpec::Matchers.define :maybe_be_permitted_to do |*args|

  def supports_block_expectations?
    true
  end

  failure_message do |actual|
    "expected that #{ actual.class.name } might be permitted to #{ expected.first } #{ expected.second }"
  end

  match do |policy|
    policy.permit?( *args ) == :maybe
  end
end

RSpec::Matchers.define :absolutely_be_permitted_to do |*args|

  def supports_block_expectations?
    true
  end

  failure_message do |actual|
    "expected that #{ actual.class.name } would absolutely be permitted to #{ expected.first } #{ expected.second }"
  end

  match do |policy|
    policy.permit?( *args ) == :yes
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
shamu-0.0.18 lib/shamu/rspec/matchers.rb
shamu-0.0.17 lib/shamu/rspec/matchers.rb
shamu-0.0.15 lib/shamu/rspec/matchers.rb
shamu-0.0.14 lib/shamu/rspec/matchers.rb
shamu-0.0.13 lib/shamu/rspec/matchers.rb
shamu-0.0.11 lib/shamu/rspec/matchers.rb
shamu-0.0.9 lib/shamu/rspec/matchers.rb
shamu-0.0.8 lib/shamu/rspec/matchers.rb
shamu-0.0.7 lib/shamu/rspec/matchers.rb
shamu-0.0.5 lib/shamu/rspec/matchers.rb
shamu-0.0.4 lib/shamu/rspec/matchers.rb
shamu-0.0.3 lib/shamu/rspec/matchers.rb
shamu-0.0.2 lib/shamu/rspec/matchers.rb