#465: updated Api::V1::ArchesController, specs
This commit is contained in:
parent
becedf0534
commit
f59800668a
|
@ -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
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class ArchPolicy < ApplicationPolicy
|
||||
|
||||
def index?
|
||||
true
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue