Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #And here is my test:
- it "passes the token" do
- get :new, nil,
- :authorization => ActionController::HttpAuthentication::Token.encode_credentials("test_access1")
- assigns(:token).should be "test_access1"
- end
- #Here's my before filter:
- def restrict_access
- authenticate_or_request_with_http_token do |token, options|
- api_key = ApiKey.find_by_access_token(token)
- @user = api_key.user unless api_key.nil?
- @token = token #set just for the sake of testing
- !api_key.nil?
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement