Added download emails spec and renamed newsletters spec

This commit is contained in:
María Checa
2018-02-15 16:40:39 +01:00
committed by Bertocq
parent c78ae7e346
commit 752ffd678f
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
require 'rails_helper'
feature "Admin download user emails" do
background do
admin = create(:administrator)
login_as(admin.user)
end
context "Index" do
scenario "returns the selected users segment csv file" do
user1 = create(:user)
user2 = create(:user)
visit admin_emails_download_index_path
within('#admin_download_emails') do
select 'All users', from: 'users_segment'
click_button 'Download emails list'
end
header = page.response_headers['Content-Disposition']
expect(header).to match /^attachment/
expect(header).to match /filename="All users.csv"$/
expect(page).to have_content(user1.email)
expect(page).to have_content(user2.email)
end
end
end