Merge pull request #9269 from jibees/fix-@order-distributor-website-in-/order/ORDER_ID-page

As a customer, on an order page, distributor website should link to the order that is actually showing
This commit is contained in:
Maikel
2022-06-21 09:39:46 +10:00
committed by GitHub
2 changed files with 12 additions and 1 deletions

View File

@@ -10,7 +10,7 @@
= t(:order_back_to_store)
.columns.small-12.medium-6
- if @order.distributor.website.present?
= link_to_service "https://", current_order.distributor.website, class: "button expand" do
= link_to_service "https://", @order.distributor.website, class: "button expand" do
= t(:order_back_to_website)
- else
 

View File

@@ -56,6 +56,17 @@ describe "Order Management", js: true do
visit order_path(order)
expect(page).to be_confirmed_order_page
end
it "allows the user to see a link to distributor website when distributor has one" do
distributor.update!(website: "www.example.com")
visit order_path(order, order_token: order.token)
expect(page).to have_link "Back To Website", href: "https://www.example.com"
end
it "doesn't show any link if the distributor doesn't have a website" do
visit order_path(order, order_token: order.token)
expect(page).not_to have_link "Back To Website"
end
end
context "when logged in as the customer" do