0
0
Fork 0

File cleanup/organization in controllers/concerns (#27846)

This commit is contained in:
Matt Jankowski 2023-11-30 09:39:41 -05:00 committed by GitHub
parent 0530ce5e95
commit 1f1c75bba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 26 additions and 26 deletions

View file

@ -1,35 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
describe ExportControllerConcern do
controller(ApplicationController) do
include ExportControllerConcern
def index
send_export_file
end
def export_data
'body data value'
end
end
describe 'GET #index' do
it 'returns a csv of the exported data when signed in' do
user = Fabricate(:user)
sign_in user
get :index, format: :csv
expect(response).to have_http_status(200)
expect(response.media_type).to eq 'text/csv'
expect(response.headers['Content-Disposition']).to start_with 'attachment; filename="anonymous.csv"'
expect(response.body).to eq 'body data value'
end
it 'returns unauthorized when not signed in' do
get :index, format: :csv
expect(response).to have_http_status(401)
end
end
end