From fafbba20d67e75072d2de72c4d26ec2cf682e8ca Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Tue, 7 Jul 2015 12:57:40 +0300 Subject: [PATCH] Add csv download test #2691 --- app/models/account_activity.rb | 2 ++ spec/features/registrar/account_activity_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/app/models/account_activity.rb b/app/models/account_activity.rb index 9092563c0..5bd17c79f 100644 --- a/app/models/account_activity.rb +++ b/app/models/account_activity.rb @@ -1,3 +1,5 @@ +require 'csv' + class AccountActivity < ActiveRecord::Base include Versions belongs_to :account diff --git a/spec/features/registrar/account_activity_spec.rb b/spec/features/registrar/account_activity_spec.rb index e2bc3be3a..a9cc9c59e 100644 --- a/spec/features/registrar/account_activity_spec.rb +++ b/spec/features/registrar/account_activity_spec.rb @@ -27,5 +27,12 @@ feature 'Account activity', type: :feature do current_path.should == '/registrar/account_activities' page.should have_text('+110.0 EUR') end + + it 'should download csv' do + visit '/registrar/account_activities' + click_link 'Export CSV' + response_headers['Content-Type'].should == 'text/csv' + response_headers['Content-Disposition'].should match(/attachment; filename="account_activities_\d+\.csv"/) + end end end