Skip to content

Instantly share code, notes, and snippets.

Created April 16, 2012 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2c077538bddfdb9c76bd to your computer and use it in GitHub Desktop.
Save anonymous/2c077538bddfdb9c76bd to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe "/auth", :type => :api do
let(:token) { "AAACm1V7H288BAEsdcHrcsMGDmjqTKLchLIFHu2Jh0HeZA0XZBvyuyZCvOGEFr9mMp4oiMFr2Yw6Nq1leTf9FasRZBKKtXUMZD" }
it "should start off as logged out" do
response = get_json('api/v1/auth/current-user.json')
response['success'].should == false
end
describe "/login" do
it "should work with a valid token" do
post "api/v1/auth/login.json", :token => token
login_response = post_json 'api/v1/auth/login.json', :token => token
login_response['success'].should == true
response = get_json("api/v1/auth/current-user.json")
response['first_name'].should == 'Venkat'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment