Skip to content

Commit

Permalink
improve specs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpbrett committed Mar 29, 2021
1 parent 8867f1e commit 5c94095
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ module Subscriptions
end

context "when there are also subscription issues" do
let(:subscription_issues) { [101, 212] }
let(:subscription) { double(:subscription, id: 101) }
let(:order) { double(:order, id: 1) }

before do
summary.record_order(order)
summary.record_success(order)
summary.record_subscription_issue(subscription)
end

it "includes subscription issues in the count" do
summary.instance_variable_set(:@order_ids, order_ids)
summary.instance_variable_set(:@success_ids, success_ids)
summary.instance_variable_set(:@subscription_issues, subscription_issues)
expect(summary.issue_count).to eq 4 # 7, 9, 101, 212
expect(summary.issue_count).to eq 1
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/jobs/subscription_placement_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@

context "when the proxy order fails to generate an order" do
before do
allow(proxy_order).to receive(:initialise_order!) { nil }
allow(proxy_order).to receive(:order) { nil }
end

it "records an error " do
expect(job).to receive(:record_subscription_issue)
expect(job).to_not receive(:place_order)
job.send(:place_proxy_order, proxy_order)
job.send(:place_order_for, proxy_order)
end
end
end
Expand Down

0 comments on commit 5c94095

Please sign in to comment.