2024-04-25 16:46:20 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-03-23 16:46:18 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
2024-04-25 16:46:20 -04:00
|
|
|
RSpec.describe 'Exports', type: :request do
|
2024-05-31 17:18:57 -04:00
|
|
|
describe 'GET /download' do
|
2024-03-23 16:46:18 -04:00
|
|
|
before do
|
2024-04-25 16:46:20 -04:00
|
|
|
stub_request(:any, 'https://api.github.com/repos/Freika/dawarich/tags')
|
|
|
|
|
.to_return(status: 200, body: '[{"name": "1.0.0"}]', headers: {})
|
|
|
|
|
|
2024-03-23 16:46:18 -04:00
|
|
|
sign_in create(:user)
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-31 17:18:57 -04:00
|
|
|
it 'returns a success response with a file' do
|
|
|
|
|
get export_download_path
|
2024-05-23 14:35:31 -04:00
|
|
|
|
2024-05-31 17:18:57 -04:00
|
|
|
expect(response).to be_successful
|
|
|
|
|
expect(response.headers['Content-Disposition']).to include('attachment')
|
2024-03-23 16:46:18 -04:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|