2012-10-04 14:13:55 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-02-19 01:12:08 +00:00
|
|
|
describe Api::V1::ArchesController, type: :controller do
|
2012-10-04 14:13:55 +01:00
|
|
|
|
|
|
|
before { FactoryGirl.create(:arch) }
|
|
|
|
|
|
|
|
context 'for guest' do
|
|
|
|
it "should be able to perform index action", :anonymous_access => true do
|
2014-01-21 04:51:49 +00:00
|
|
|
get :index, format: :json
|
2015-03-23 23:27:23 +00:00
|
|
|
expect(response).to render_template(:index)
|
2012-10-04 14:13:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be able to perform get_id action', :anonymous_access => false do
|
2014-01-21 04:51:49 +00:00
|
|
|
get :index, format: :json
|
2015-03-23 23:27:23 +00:00
|
|
|
expect(response.status).to eq 401
|
2012-10-04 14:13:55 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'for simple user' do
|
|
|
|
before do
|
|
|
|
stub_symlink_methods
|
|
|
|
http_login(FactoryGirl.create(:user))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be able to perform index action" do
|
2014-01-21 04:51:49 +00:00
|
|
|
get :index, format: :json
|
2015-03-23 23:27:23 +00:00
|
|
|
expect(response).to render_template(:index)
|
2012-10-04 14:13:55 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|