Skip to content

Commit

Permalink
[#162396] Fix order forms redirect (#4527)
Browse files Browse the repository at this point in the history
* Fix order forms redirect

* Add more explicit expectation
  • Loading branch information
LeticiaErrandonea authored Aug 28, 2024
1 parent 4c6e559 commit 3181139
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/order_detail_stored_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def upload_order_file
@order_detail.save! # trigger the OrderDetailObserver callbacks
redirect_to_facility_order(consider_merge_order: true)
else
redirect_to_facility_order
redirect_to(order_path(@order))
end
else
flash.now[:error] = text("upload_order_file.error")
Expand Down
17 changes: 17 additions & 0 deletions spec/system/placing_an_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ def add_to_cart
end
end

describe "adding a service that requires form" do
let!(:product) { create(:setup_service, :with_order_form) }

it "can place an order" do
visit facility_service_path(facility.url_name, product.url_name)
click_link "Add to cart"
choose account.to_s
click_button "Continue"
click_link "Upload Order Form"
attach_file "stored_file[file]", Rails.root.join("spec", "files", "template1.txt")
click_button "Upload"
expect(page).to have_current_path(order_path(Order.last))
click_button "Purchase"
expect(page).to have_content "Order Receipt"
end
end

describe "when the order's account payment source is invalid" do
let(:other_user) { FactoryBot.create(:user) }
let(:account) { FactoryBot.create(:nufs_account, :with_account_owner, owner: other_user) }
Expand Down

0 comments on commit 3181139

Please sign in to comment.