-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace :reports do | ||
|
||
desc 'Index all reports' | ||
task :index => :environment do | ||
reports = Report.all | ||
reports.each do |report| | ||
report.queue_report | ||
puts "Queued indexing for #{report.uid} Data Usage Reports." | ||
end | ||
|
||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require "rails_helper" | ||
|
||
describe "rake reports:index", type: :task do | ||
|
||
# it "preloads the Rails environment" do | ||
# expect(task.prerequisites).to include "environment" | ||
# end | ||
|
||
# it "runs gracefully with no subscribers" do | ||
# expect { task.execute }.not_to raise_error | ||
# end | ||
|
||
# it "logs to stdout" do | ||
# expect { task.execute }.to output("Index reports\n").to_stdout | ||
# end | ||
|
||
# it "index all reports" do | ||
# report = create(:report) | ||
|
||
# task.invoke | ||
|
||
# expect(report).to have_received_invoice | ||
# end | ||
|
||
# it "checks in with Dead Mans Snitch" do | ||
# dead_mans_snitch_request = stub_request(:get, "https://nosnch.in/c2354d53d2") | ||
|
||
# task.execute | ||
|
||
# expect(dead_mans_snitch_request).to have_been_requested | ||
# end | ||
|
||
# matcher :have_received_invoice do | ||
# match_unless_raises do |subscriber| | ||
# expect(last_email_sent).to be_delivered_to subscriber.email | ||
# expect(last_email_sent).to have_subject 'Your invoice' | ||
# end | ||
# end | ||
|
||
end |