Should link to order.distributor website

- order: the order summary the customer is seeing on this page
 - current_order: the order is the customer is check-outing

+ add specs
This commit is contained in:
Jean-Baptiste Bellet
2022-06-07 16:06:49 +02:00
parent 9fee4f1554
commit bf40e59bec
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