Created
May 18, 2013 13:44
-
-
Save andreaseriksson/5604439 to your computer and use it in GitHub Desktop.
RSPEC Controller spec #Testing non-HTML controller output
This file contains 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
# link_to 'Export', messages_path(format: :csv) | |
describe 'CSVoutput' do | |
it "returns a CSV file" do | |
get :index, format: :csv | |
expect(response.headers['Content-Type']).to have_content 'text/csv' | |
end | |
it 'returns content' do | |
create(:message, | |
name: 'Aaron', | |
email: '[email protected]', | |
message: 'Testing!') | |
get :index, format: :csv | |
response.body.should have_content 'Aaron,[email protected],Testing!' | |
expect(response.body).to have_content 'Aaron,[email protected],Testing!' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment