Last active
March 8, 2023 20:49
-
-
Save sephraim/b087cefeca0a8052698e8fd65d1af1ef to your computer and use it in GitHub Desktop.
[Test that a file gets downloaded in Rails] Use RSpec to test that a file gets downloaded in a Rails app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it 'downloads the file' do | |
expect(controller).to receive(:send_file).with(GooglePlacesApiClient::DEFAULT_CSV_FILEPATH, type: 'text/csv').and_call_original | |
get :download_report | |
end | |
# OR | |
it 'does not try to download the file' do | |
expect(controller).not_to receive(:send_file) | |
get :download_report | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment