Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #247 from codeforamerica/csv-export-tests
Browse files Browse the repository at this point in the history
Integration tests that wrap CSV exporting.
  • Loading branch information
waltz committed Jan 20, 2016
2 parents 6a82213 + a255dac commit 7308d4e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
40 changes: 40 additions & 0 deletions spec/features/export_spec.rb
@@ -0,0 +1,40 @@
require 'spec_helper'

describe 'Exporting' do
let(:export_data_path) { Rails.root.join('spec', 'support', 'fixtures', 'valid_export.csv') }
let(:export_data) { File.read(export_data_path) }

let(:location) { FactoryGirl.create(:location, name: 'El Farolito') }
let(:call) { FactoryGirl.create(:call, id: 456, location: location) }

let!(:numerical_question) {
FactoryGirl.create(:question,
:numerical_response,
{ question_text: 'Do you like tacos?' })
}
let!(:numerical_answer) {
FactoryGirl.create(:answer,
:numerical_response,
question: numerical_question,
numerical_response: 1,
call: call)
}

let!(:voice_question) {
FactoryGirl.create(:question,
:voice_file,
question_text: 'What about chimichangas?')
}
let!(:voice_answer) {
FactoryGirl.create(:answer,
:voice_file,
question: voice_question,
voice_file_url: 'rant.mp3',
call: call)
}

it 'mentions the call id' do
visit '/export.csv'
expect(page).to have_content(export_data)
end
end
2 changes: 2 additions & 0 deletions spec/support/fixtures/valid_export.csv
@@ -0,0 +1,2 @@
Call ID,Location,Do you like tacos?,What about chimichangas?
456,El Farolito,Agree,rant.mp3

0 comments on commit 7308d4e

Please sign in to comment.