Skip to content
Snippets Groups Projects
Commit 809bae88 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding collection controller specs

parent d4a32187
No related branches found
No related tags found
No related merge requests found
......@@ -3,17 +3,26 @@ require 'rails_helper'
RSpec.describe V1::CollectionsController, type: :controller do
fixtures :applications
it { should use_before_action(:authenticate_user!) }
it { should use_before_action(:set_collection) }
it { should route(:get, '/v1/collections').to(action: :index) }
describe 'GET #index' do
it 'will return an array of collections' do
auth_app applications(:test_app), @request
get :index
expect(response).to have_http_status(:ok)
expect(response.content_type).to eq "application/json"
context 'when application is authenticated' do
before do
auth_app applications(:test_app), @request
get :index
end
it { expect(response.content_type).to eq('application/json') }
it { expect(response).to have_http_status(:ok) }
end
it 'will return not authorized when app is not authenticated' do
get :index
expect(response).to have_http_status(:unauthorized)
context 'when application is not authenticated' do
before { get :index }
it { expect(response).to have_http_status(:unauthorized) }
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment