nathanl / authority

*CURRENTLY UNMAINTAINED*. Authority helps you authorize actions in your Rails app. It's ORM-neutral and has very little fancy syntax; just group your models under one or more Authorizer classes and write plain Ruby methods on them.
MIT License
1.21k stars 67 forks source link

Authorize any_instance stubbing does not work on RSpec 2.14+ #60

Closed thbar closed 11 years ago

thbar commented 11 years ago

Hello!

in case it helps someone else, I just noticed that the following spec is not passing anymore when using Authority together with RSpec 2.14+:

    it 'verifies authorization' do
      MembershipAuthorizer.any_instance.stub(:deletable_by?).and_return(false)
      expect {
        post :destroy, valid_params
      }.to raise_error(Authority::SecurityViolation)
    end

Rolling back to RSpec 2.13.0 makes the spec pass again.

Note that this is not necessarily an issue with Authority itself, but I thought I would share it here in case, to track that down and share it with others, since it took me a bit of time to track it initially.

nathanl commented 11 years ago

Thanks for sharing! Your description does make it sound like an issue with Rspec, so I'm going to close this issue, but if anyone has evidence that it's a problem in Authority, please comment here.