Created
October 24, 2011 07:17
-
-
Save ahawkins/1308530 to your computer and use it in GitHub Desktop.
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
require 'spec_helper' | |
describe ApplicationController do | |
let(:user) { mock_model(User) } | |
controller do | |
before_filter :require_app!, :only => :app_required | |
def index | |
raise CanCan::AccessDenied | |
end | |
def missing_app_token | |
end | |
end | |
it "should return a 403 if the user is not authorized" do | |
User.stub(:find_by_api_key).and_return(user) | |
get :index | |
response.code.should eql('403') | |
end | |
it "should return a 412 if there is no app token when required" do | |
User.stub(:find_by_api_key).and_return(user) | |
get :missing_app_token | |
response.code.should eql('412') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment