Skip to content

Commit

Permalink
Uncomment passing specs for SubscriptionPlacementJob
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinalim committed Mar 27, 2019
1 parent f3e7c5a commit b956b4e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/jobs/subscription_placement_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
variant3.update_attribute(:on_hand, 0)
end

xit "caps quantity at the stock level for stock-limited items, and reports the change" do
it "caps quantity at the stock level for stock-limited items, and reports the change" do
changes = job.send(:cap_quantity_and_store_changes, order.reload)
expect(line_item1.reload.quantity).to be 3 # not capped
expect(line_item2.reload.quantity).to be 2 # capped
Expand All @@ -104,7 +104,7 @@
variant3.update_attribute(:on_hand, 0)
end

xit "sets quantity to 0 for unavailable items, and reports the change" do
it "sets quantity to 0 for unavailable items, and reports the change" do
changes = job.send(:cap_quantity_and_store_changes, order.reload)
expect(line_item1.reload.quantity).to be 0 # unavailable
expect(line_item2.reload.quantity).to be 2 # capped
Expand Down Expand Up @@ -151,7 +151,7 @@
allow(job).to receive(:unavailable_stock_lines_for) { order.line_items }
end

xit "does not place the order, clears, all adjustments, and sends an empty_order email" do
it "does not place the order, clears, all adjustments, and sends an empty_order email" do
expect{ job.send(:process, order) }.to_not change{ order.reload.completed_at }.from(nil)
expect(order.adjustments).to be_empty
expect(order.total).to eq 0
Expand All @@ -162,23 +162,23 @@
end

context "when at least one stock item is available after capping stock" do
xit "processes the order to completion, but does not process the payment" do
it "processes the order to completion, but does not process the payment" do
# If this spec starts complaining about no shipping methods being available
# on CI, there is probably another spec resetting the currency though Rails.cache.clear
expect{ job.send(:process, order) }.to change{ order.reload.completed_at }.from(nil)
expect(order.completed_at).to be_within(5.seconds).of Time.zone.now
expect(order.payments.first.state).to eq "checkout"
end

xit "does not enqueue confirmation emails" do
it "does not enqueue confirmation emails" do
expect{ job.send(:process, order) }.to_not enqueue_job ConfirmOrderJob
expect(job).to have_received(:send_placement_email).with(order, anything).once
end

context "when progression of the order fails" do
before { allow(order).to receive(:next) { false } }

xit "records an error and does not attempt to send an email" do
it "records an error and does not attempt to send an email" do
expect(job).to_not receive(:send_placement_email)
expect(job).to receive(:record_and_log_error).once
job.send(:process, order)
Expand Down

0 comments on commit b956b4e

Please sign in to comment.