square / rails-auth

Modular resource-based authentication and authorization for Rails/Rack
Apache License 2.0
291 stars 26 forks source link

Fix permit custom matcher message #51

Closed leecunliffe closed 6 years ago

leecunliffe commented 6 years ago

The custom matcher calls .values on a Credentials object. This change means descriptions will print correctly for this custom matcher.

leecunliffe commented 6 years ago

Unsure how to write a spec for this? But with this, output of

rspec spec/rails/auth/rspec/matchers/acl_matchers_spec.rb

Changes from

RSpec ACL matchers
  /baz/quux
    example at ./spec/rails/auth/rspec/matchers/acl_matchers_spec.rb:16 (Got an error when generating description from matcher: NoMethodError: undefined method `values' for #<Rails::Auth::Credentials:0x007fe05e585020> -- /Users/leec/Development/rails-auth/lib/rails/auth/rspec/matchers/acl_matchers.rb:9:in `block (2 levels) in <top (required)>')
    should not allow GETs by unauthenticated clients
    example at ./spec/rails/auth/rspec/matchers/acl_matchers_spec.rb:17 (Got an error when generating description from matcher: NoMethodError: undefined method `values' for #<Rails::Auth::Credentials:0x007fe05e52dc30> -- /Users/leec/Development/rails-auth/lib/rails/auth/rspec/matchers/acl_matchers.rb:9:in `block (2 levels) in <top (required)>')

to:

RSpec ACL matchers
  /baz/quux
    should allow GETs by #<InstanceDouble(Rails::Auth::X509::Certificate) "OU=ponycopter">
    should not allow GETs by #<InstanceDouble(Rails::Auth::X509::Certificate) "OU=derpderp">
    should not allow GETs by unauthenticated clients
nerdrew commented 6 years ago

Should this PR include a version bump?

leecunliffe commented 6 years ago

bumped bugfix version, updated the CHANGES.