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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix the Gift Card show view for guest orders (#13201)
Łukasz Adamczykdd18c23d043a
diff --git a/admin/app/views/spree/admin/gift_cards/show.html.erb b/admin/app/views/spree/admin/gift_cards/show.html.erbindex f572fe07d2..1600d197f8 100644--- a/admin/app/views/spree/admin/gift_cards/show.html.erb+++ b/admin/app/views/spree/admin/gift_cards/show.html.erb@@ -67,7 +67,7 @@<% end %></td><td>- <%= order.user.email %>+ <%= render 'spree/admin/orders/customer_summary', order: order %></td><td class="text-right"><%= order.display_gift_card_total %>diff --git a/admin/spec/controllers/spree/admin/gift_cards_controller_spec.rb b/admin/spec/controllers/spree/admin/gift_cards_controller_spec.rbindex 6a72941ebf..4fd3060082 100644--- a/admin/spec/controllers/spree/admin/gift_cards_controller_spec.rb+++ b/admin/spec/controllers/spree/admin/gift_cards_controller_spec.rb@@ -79,6 +79,47 @@ describe Spree::Admin::GiftCardsController, type: :controller dosubjectexpect(assigns(:object)).to eq(gift_card)end++ context 'for a redeemed gift card' do+ let!(:order) { create(:order, email: '[email protected]', user: user, gift_card: gift_card) }+ let(:gift_card) { create(:gift_card, :redeemed, user: user) }++ it 'renders the show template' do+ subject+ expect(response).to render_template(:show)+ expect(response).to have_http_status(:ok)+ end++ it 'assigns the gift card' do+ subject+ expect(assigns(:object)).to eq(gift_card)+ end++ it 'assigns the order' do+ subject+ expect(assigns(:orders)).to eq([order])+ end++ context 'when the order is a guest order' do+ let(:user) { nil }++ it 'renders the show template' do+ subject+ expect(response).to render_template(:show)+ expect(response).to have_http_status(:ok)+ end++ it 'assigns the gift card' do+ subject+ expect(assigns(:object)).to eq(gift_card)+ end++ it 'assigns the order' do+ subject+ expect(assigns(:orders)).to eq([order])+ end+ end+ endenddescribe '#new' do