Skip to content

Commit

Permalink
Clear cross core project when clearing cart (#4439)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeticiaErrandonea authored Jul 17, 2024
1 parent fd1def5 commit d3b78bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def clear_cart?
order_details.destroy_all
self.facility = nil
self.account = nil
self.cross_core_project_id = nil
save
end

Expand Down
2 changes: 2 additions & 0 deletions spec/models/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,14 @@ def define_purchasable_instrument
context "clear" do
it "clear should destroy all order_details and set the cart.facility to nil when clearing cart" do
@cart.add(@service, 1)
@cart.update(cross_core_project_id: create(:project, facility: @facility).id)
expect(@cart.reload.facility).to eq(@facility)
@cart.clear!
expect(@cart.facility).to be_nil
expect(@cart.order_details.size).to eq(0)
expect(@cart.account).to be_nil
expect(@cart.state).to eq("new")
expect(@cart.cross_core_project_id).to be_nil
end
end

Expand Down

0 comments on commit d3b78bb

Please sign in to comment.