Created
July 16, 2013 09:43
-
-
Save universal/6007307 to your computer and use it in GitHub Desktop.
cancan and authentication check
This file contains 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
describe MatchesController do | |
let(:group) {FactoryGirl.create(:group)} | |
context "requires login and checks authorization" do | |
it "for GET 'new'" do | |
controller.should_receive(:authenticate_user!).and_return(false) | |
expect{get :new, group_id: group.id}.to raise_error(CanCan::AccessDenied) | |
end | |
it "for POST 'create'" do | |
controller.should_receive(:authenticate_user!).and_return(false) | |
expect{post :create, group_id: group.id}.to raise_error(CanCan::AccessDenied) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment