* trying out the login/logout as singleton pats

This commit is contained in:
Seth Call 2012-11-14 00:08:32 -06:00
parent 0d3334a3b0
commit ea7f9339a4
2 changed files with 5 additions and 5 deletions

View File

@ -48,8 +48,8 @@ SampleApp::Application.routes.draw do
match '/users/confirm/:signup_token' => 'api_users#signup_confirm', :via => :post, :as => 'api_signup_confirmation'
# login/logout
match '/auth_sessions' => 'api_users#auth_session_create', :via => :post
match '/auth_sessions' => 'api_users#auth_session_delete', :via => :delete
match '/auth_session' => 'api_users#auth_session_create', :via => :post
match '/auth_session' => 'api_users#auth_session_delete', :via => :delete
# friend requests
match '/users/:id/friend_requests' => 'api_users#friend_request_index', :via => :get

View File

@ -20,7 +20,7 @@ describe "User API ", :type => :api do
last_response.status.should == 403
# login
post '/api/auth_sessions.json', { :email => user.email, :password => user.password }.to_json, "CONTENT_TYPE" => 'application/json'
post '/api/auth_session.json', { :email => user.email, :password => user.password }.to_json, "CONTENT_TYPE" => 'application/json'
last_response.status.should == 200
JSON.parse(last_response.body).should == { "success" => true }
@ -29,7 +29,7 @@ describe "User API ", :type => :api do
last_response.status.should == 200
# log back out
delete '/api/auth_sessions.json', "CONTENT_TYPE" => 'application/json'
delete '/api/auth_session.json', "CONTENT_TYPE" => 'application/json'
# can't access most apis; not logged in yet!'
get '/api/users.json', "CONTENT_TYPE" => 'application/json'
@ -38,7 +38,7 @@ describe "User API ", :type => :api do
it "bad login" do
# login
post '/api/auth_sessions.json', { :email => "nothing", :password => "mur" }.to_json, "CONTENT_TYPE" => 'application/json'
post '/api/auth_session.json', { :email => "nothing", :password => "mur" }.to_json, "CONTENT_TYPE" => 'application/json'
last_response.status.should == 404
JSON.parse(last_response.body).should == { "success" => false }