From ea7f9339a4a39eb550f0dc86b3e4ea6df05b0b71 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 14 Nov 2012 00:08:32 -0600 Subject: [PATCH] * trying out the login/logout as singleton pats --- config/routes.rb | 4 ++-- spec/requests/users_api_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 29c928931..b93048b06 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/spec/requests/users_api_spec.rb b/spec/requests/users_api_spec.rb index 34441498d..7c6f41bc8 100644 --- a/spec/requests/users_api_spec.rb +++ b/spec/requests/users_api_spec.rb @@ -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 }