From 68de2f930dd143ce9b870746a96c0f7bd2f1e674 Mon Sep 17 00:00:00 2001 From: Adam Mueller Date: Fri, 24 Jul 2015 13:11:35 -0700 Subject: [PATCH 1/2] Add source view for store credits Pretty simple, just shows some basic info. Mostly to stop the exception from happening. --- .../source_views/_storecredit.html.erb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 backend/app/views/spree/admin/payments/source_views/_storecredit.html.erb diff --git a/backend/app/views/spree/admin/payments/source_views/_storecredit.html.erb b/backend/app/views/spree/admin/payments/source_views/_storecredit.html.erb new file mode 100644 index 00000000000..ec999ca4578 --- /dev/null +++ b/backend/app/views/spree/admin/payments/source_views/_storecredit.html.erb @@ -0,0 +1,21 @@ +
+ <%= Spree.t(:store_credit, scope: :store_credit) %> + +
+
+
+
<%= Spree.t(:category) %>:
+
<%= payment.source.category.name%>
+ +
<%= Spree.t(:memo) %>:
+
<%= payment.source.memo %>
+ +
<%= Spree.t(:created_by) %>:
+
<%= payment.source.created_by.email %>
+ +
<%= Spree.t(:issued_on, scope: [:admin, :store_credits]) %>:
+
<%= l payment.source.created_at.to_date %>
+
+
+
+
From 9674282269609a2fecfc34df65c23b285e9e977c Mon Sep 17 00:00:00 2001 From: Adam Mueller Date: Fri, 24 Jul 2015 13:36:27 -0700 Subject: [PATCH 2/2] Add test for store credit source view --- .../admin/payments/store_credits_spec.rb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 backend/spec/features/admin/payments/store_credits_spec.rb diff --git a/backend/spec/features/admin/payments/store_credits_spec.rb b/backend/spec/features/admin/payments/store_credits_spec.rb new file mode 100644 index 00000000000..bb51fba8d29 --- /dev/null +++ b/backend/spec/features/admin/payments/store_credits_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +RSpec.describe 'Store credits', type: :feature do + stub_authorization! + + let(:order) { FactoryGirl.create(:completed_order_with_totals) } + let(:payment) do + FactoryGirl.create( + :store_credit_payment, + order: order, + amount: 20 + ) + end + + it "viewing a store credit payment" do + visit spree.admin_order_payment_path(order, payment) + + expect(page).to have_content "Store Credit" + expect(page).to have_content "Amount: $20.00" + end +end