This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1574 from psu-stewardship/i#1520a-email-stats
Verify that emails are sent for monthly stats
- Loading branch information
Showing
6 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ development: | |
service_instance: "localhost" | ||
virtual_host: "http://localhost:3000/" | ||
stats_email: "ScholarSphere Stats <[email protected]>" | ||
no_reply_email: "no_repy@scholarsphere.psu.edu" | ||
no_reply_email: "no_reply@scholarsphere.psu.edu" | ||
google_analytics_id: "test-id" | ||
read_only: "false" | ||
EZID_USER: 'ezid_user' | ||
|
@@ -30,7 +30,7 @@ test: | |
service_instance: "example-test" | ||
virtual_host: "http://test.com/" | ||
stats_email: "Test email" | ||
no_reply_email: "no_repy@scholarsphere.psu.edu" | ||
no_reply_email: "no_reply@scholarsphere.psu.edu" | ||
google_analytics_id: "test-id" | ||
read_only: "false" | ||
RECAPTCHA_SITE_KEY: 'site-key' | ||
|
@@ -48,7 +48,7 @@ production: | |
service_instance: "example-prod" | ||
virtual_host: "http://test.com/" | ||
stats_email: "Test email" | ||
no_reply_email: "no_repy@scholarsphere.psu.edu" | ||
no_reply_email: "no_reply@scholarsphere.psu.edu" | ||
google_analytics_id: "test-id" | ||
derivatives_path: "path" | ||
read_only: "false" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ development: | |
service_instance: "localhost" | ||
virtual_host: "http://localhost:3000/" | ||
stats_email: "ScholarSphere Stats <[email protected]>" | ||
no_reply_email: "no_repy@scholarsphere.psu.edu" | ||
no_reply_email: "no_reply@scholarsphere.psu.edu" | ||
google_analytics_id: "test-id" | ||
read_only: "false" | ||
EZID_USER: 'ezid_user' | ||
|
@@ -30,7 +30,7 @@ test: | |
service_instance: "example-test" | ||
virtual_host: "http://test.com/" | ||
stats_email: "Test email" | ||
no_reply_email: "no_repy@scholarsphere.psu.edu" | ||
no_reply_email: "no_reply@scholarsphere.psu.edu" | ||
google_analytics_id: "test-id" | ||
read_only: "false" | ||
RECAPTCHA_SITE_KEY: 'site-key' | ||
|
@@ -48,7 +48,7 @@ production: | |
service_instance: "example-prod" | ||
virtual_host: "http://test.com/" | ||
stats_email: "Test email" | ||
no_reply_email: "no_repy@scholarsphere.psu.edu" | ||
no_reply_email: "no_reply@scholarsphere.psu.edu" | ||
google_analytics_id: "test-id" | ||
derivatives_path: "path" | ||
read_only: "false" | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,19 @@ | |
end | ||
|
||
context 'when a user has stats' do | ||
let(:user) { create(:user) } | ||
let(:user) { create(:user, email: '[email protected]') } | ||
let(:message) { ActionMailer::Base.deliveries.first } | ||
|
||
before do | ||
allow(PsuDir::LdapUser).to receive(:check_ldap_exist!).with(user.login).and_return(true) | ||
UserStat.create(user_id: user.id, date: (Date.today.last_month.beginning_of_month + 10), file_downloads: 5) | ||
end | ||
|
||
it 'sends an email to the user' do | ||
expect(UserStatsNotificationJob).to receive(:perform_later) | ||
run_task('scholarsphere:stats:notify') | ||
expect(message.to).to contain_exactly('[email protected]') | ||
expect(message.from).to contain_exactly(ENV['no_reply_email']) | ||
expect(message.subject).to eq('ScholarSphere - Reporting Monthly Downloads and Views') | ||
end | ||
end | ||
end | ||
|