#691: updated routes according to Vladimir's comments
This commit is contained in:
parent
5aa5bbc0b8
commit
f3605a1211
|
@ -7,12 +7,10 @@ class Api::V1::UsersController < Api::V1::BaseController
|
|||
before_filter :set_current_user, :except => :show
|
||||
|
||||
def show
|
||||
@user = current_user if params[:id].nil?
|
||||
if @user
|
||||
render :show
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def show_current_user
|
||||
render :show
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -48,7 +48,8 @@ Rosa::Application.routes.draw do
|
|||
}
|
||||
end
|
||||
resources :users, :only => [:show]
|
||||
resource :user, :only => [:show, :update] do
|
||||
get 'user' => 'users#show_current_user'
|
||||
resource :user, :only => [:update] do
|
||||
member {
|
||||
get :notifiers
|
||||
put :notifiers
|
||||
|
|
|
@ -10,7 +10,7 @@ describe Api::V1::UsersController do
|
|||
|
||||
context 'for guest' do
|
||||
|
||||
[:show, :notifiers].each do |action|
|
||||
[:show_current_user, :notifiers].each do |action|
|
||||
it "should not be able to perform #{ action } action for a current user" do
|
||||
get action, :format => :json
|
||||
response.should_not be_success
|
||||
|
@ -56,10 +56,10 @@ describe Api::V1::UsersController do
|
|||
http_login(@user)
|
||||
end
|
||||
|
||||
[:show, :notifiers].each do |action|
|
||||
[:show_current_user, :notifiers].each do |action|
|
||||
it "should be able to perform #{ action } action for a current user" do
|
||||
get action, :format => :json
|
||||
response.should render_template(action)
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue