Created
March 28, 2014 01:43
-
-
Save anlek/9823321 to your computer and use it in GitHub Desktop.
How to run tests as if CanCan was loaded into the system.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before(:all) do | |
module CanCan; end | |
end | |
# ... test as if CanCan exists | |
after(:all) do | |
Object.send(:remove_const, :CanCan) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This might not be the best idea, seems the better idea would be:
and in the test, just stub out
MyGem.stub(:using_cancan?).and_return true
.