Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Test checkout with `render_views`

Damian Legawiec2182aee4956c
diff --git a/storefront/app/helpers/spree/checkout_helper.rb b/storefront/app/helpers/spree/checkout_helper.rb
index 5ea7611aee..9b5b2d7330 100644
--- a/storefront/app/helpers/spree/checkout_helper.rb
+++ b/storefront/app/helpers/spree/checkout_helper.rb
@@ -38,7 +38,7 @@ module Spree
end
def already_have_an_account?
- @already_have_an_account ||= @order.email.present? && Spree.user_class.confirmed.exists?(email: @order.email.downcase)
+ @already_have_an_account ||= @order.email.present? && Spree.user_class.exists?(email: @order.email.downcase)
end
def checkout_payment_sources(payment_method = nil)
diff --git a/storefront/app/views/spree/checkout/_address.html.erb b/storefront/app/views/spree/checkout/_address.html.erb
index 86e13b79d2..6b66f7112f 100644
--- a/storefront/app/views/spree/checkout/_address.html.erb
+++ b/storefront/app/views/spree/checkout/_address.html.erb
@@ -82,7 +82,7 @@
<h5 class="font-body">
<%= Spree.t(:contact_information) %>
</h5>
- <% unless already_have_an_account? %>
+ <% if !already_have_an_account? && defined?(spree_login_path) %>
<div class="lg:text-right">
<span class="text-gray-600 text-sm">
<%= Spree.t(:already_have_an_account) %> <span class="text-primary"><%= link_to Spree.t(:login), spree_login_path, data: { turbo_frame: '_top' } %></span>
diff --git a/storefront/app/views/themes/default/spree/checkout/_footer.html.erb b/storefront/app/views/themes/default/spree/checkout/_footer.html.erb
index 94e507b20f..f0cd400f1a 100644
--- a/storefront/app/views/themes/default/spree/checkout/_footer.html.erb
+++ b/storefront/app/views/themes/default/spree/checkout/_footer.html.erb
@@ -1,10 +1,10 @@
<% cache spree_base_cache_scope.call(current_store) do %>
<div class="flex flex-col gap-4 text-sm">
<ul class="flex justify-center flex-wrap gap-4">
- <%= link_to Spree.t(:privacy_policy), "/policies/privacy_policy", target: '_blank' if legal_policy(policy: 'privacy_policy').present? %>
- <%= link_to Spree.t(:terms_of_service), "/policies/terms_of_service", target: '_blank' if legal_policy(policy: 'terms_of_service').present? %>
- <%= link_to Spree.t(:returns_policy), "/policies/returns_policy", target: '_blank' if legal_policy(policy: 'returns_policy').present? %>
- <%= link_to Spree.t(:shipping_policy), "/policies/shipping_policy", target: '_blank' if legal_policy(policy: 'shipping_policy').present? %>
+ <%= link_to Spree.t(:privacy_policy), "/policies/privacy_policy", target: '_blank' if legal_policy('privacy_policy').present? %>
+ <%= link_to Spree.t(:terms_of_service), "/policies/terms_of_service", target: '_blank' if legal_policy('terms_of_service').present? %>
+ <%= link_to Spree.t(:returns_policy), "/policies/returns_policy", target: '_blank' if legal_policy('returns_policy').present? %>
+ <%= link_to Spree.t(:shipping_policy), "/policies/shipping_policy", target: '_blank' if legal_policy('shipping_policy').present? %>
</ul>
</div>
<% end %>
diff --git a/storefront/spec/controllers/spree/checkout_controller_spec.rb b/storefront/spec/controllers/spree/checkout_controller_spec.rb
index 282d074dfc..457b19b27b 100644
--- a/storefront/spec/controllers/spree/checkout_controller_spec.rb
+++ b/storefront/spec/controllers/spree/checkout_controller_spec.rb
@@ -7,6 +7,8 @@ describe Spree::CheckoutController, type: :controller do
let(:user) { nil }
let(:order) { create(:order_with_totals, store: store, user: user, email: '[email protected]') }
+ render_views
+
let(:address_params) do
address = build(:address, country: country, state: state)
address.attributes.except('created_at', 'updated_at')