#465: updated Api::V1::ArchesController, specs

This commit is contained in:
Vokhmin Alexey V 2015-03-24 02:27:23 +03:00
parent becedf0534
commit f59800668a
3 changed files with 10 additions and 4 deletions

View File

@ -2,8 +2,8 @@ class Api::V1::ArchesController < Api::V1::BaseController
before_action :authenticate_user! unless APP_CONFIG['anonymous_access']
def index
authorize :arch
@arches = Arch.order(:id).paginate(paginate_params)
respond_to :json
end
end

View File

@ -0,0 +1,6 @@
class ArchPolicy < ApplicationPolicy
def index?
true
end
end

View File

@ -7,12 +7,12 @@ describe Api::V1::ArchesController, type: :controller do
context 'for guest' do
it "should be able to perform index action", :anonymous_access => true do
get :index, format: :json
should render_template(:index)
expect(response).to render_template(:index)
end
it 'should be able to perform get_id action', :anonymous_access => false do
get :index, format: :json
response.status.should == 401
expect(response.status).to eq 401
end
end
@ -24,7 +24,7 @@ describe Api::V1::ArchesController, type: :controller do
it "should be able to perform index action" do
get :index, format: :json
should render_template(:index)
expect(response).to render_template(:index)
end
end
end