-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from adammathys/store-credit-source-view
Add source view for store credits
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
backend/app/views/spree/admin/payments/source_views/_storecredit.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<fieldset data-hook="store-credit"> | ||
<legend align="center"><%= Spree.t(:store_credit, scope: :store_credit) %></legend> | ||
|
||
<div class="row"> | ||
<div class="alpha six columns"> | ||
<dl> | ||
<dt><%= Spree.t(:category) %>:</dt> | ||
<dd><%= payment.source.category.name%></dd> | ||
|
||
<dt><%= Spree.t(:memo) %>:</dt> | ||
<dd><%= payment.source.memo %></dd> | ||
|
||
<dt><%= Spree.t(:created_by) %>:</dt> | ||
<dd><%= payment.source.created_by.email %></dd> | ||
|
||
<dt><%= Spree.t(:issued_on, scope: [:admin, :store_credits]) %>:</dt> | ||
<dd><%= l payment.source.created_at.to_date %></dd> | ||
</dl> | ||
</div> | ||
</div> | ||
</fieldset> |
21 changes: 21 additions & 0 deletions
21
backend/spec/features/admin/payments/store_credits_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |