Comments (9)
Also, this probably isn't needed since that PR fixes it, but for future reference, in case anybody has issues in the future and googles this:
My spec_helper started with:
require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root)
require 'shoulda'
require 'cancan/matchers'
require 'rspec/rails'
require 'timecop'
require 'webmock/rspec'
...and before this PR, failed unless I added require 'rspec/expectations'
right before require
ing cancan's matchers - with this PR my spec_helper remains as is.
from cancancan.
This doesn't happen with Rspec 2.13 - something changed between 2.13 and 2.14 that changed this.
If I just add require 'rspec/expectations'
to the top of lib/cancan/matchers.rb, it works okay. Not sure if that would break compatibility with other versions of rspec though. Also works if I add that line to my own spec_helper before I require cancan.
from cancancan.
This is on master
or 1.7.0
?
from cancancan.
bah.. obviously the 1.7.0
... sorry... i'll check it out.
from cancancan.
Upon some investigation:
https://github.com/rspec/rspec/commit/15ef280ac74b03f612d6038f484d80226fb38e03
Removed explicitly requiring both expectations and mocks. So it should be fixable by:
Removing
require 'rspec'
and adding
require 'rspec/core'
require 'rspec/expectations'
require 'rspec/mocks'
I'll get this in asap as a patch release.
from cancancan.
@JustinAiken I haven't actually been able to duplicate your issue, no matter where I require cancan/matches
... Could you try running against:
https://github.com/CanCanCommunity/cancancan/tree/feature/fix_rspec
And let me know if that fixes it, either that or paste a minimal spec_helper
. Super appreciated!
from cancancan.
@JustinAiken ping?
from cancancan.
Oh, haha... I was bundle
ing up that ref as you pinged me :)
Yes confirmed - that fixes it :)
from cancancan.
hahaha... great thanks, I'll push a 1.7.1
release today.
from cancancan.
Related Issues (20)
- Nil values on enums fails to authorize
- Gemspec does not have Rails version dependency for various version of the gem
- cancancan is chaninging my get request ID HOT 1
- Deep conditions nesting on sqlite => stack overflow
- Selective permissions on STI sub-classes not respected by accessible_by HOT 1
- Granting read permission on intermediate STI table prevents any records being returned HOT 4
- inconsistent behaviour with Hash subjects
- `can?` unnecessarily loads relationships in memory when it could leverage `accessible_by` HOT 1
- can? should return false when there are no attributes that the current user can perform action on
- Possible breaking change with handling of `nil` conditions in 3.5.0
- How to define ability action name that is same as the default action aliases?
- Why are merged rules still bound to the merged Ability class?
- Extra table alias is being generated, but then ignored in the final stage of an accessible_by query HOT 1
- Creating resource failes when association is polymorphic and singleton.
- Can't apply rules to `create` action without affecting `new` because of aliasing HOT 12
- Resource Loader gets ignored with Whitespace-Only ID in URL (e.g., "\n")
- Support Rails's `attribute` in Cancancan's `permitted_attributes` HOT 1
- Add own SQL strategy
- restricting associated records, does it work? HOT 2
- Multiple hash definitions results in invalid SQL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cancancan.