Skip to content

Commit ce1c7ef

Browse files
committed
Setup test harness for autoload issue
solidusio/solidus_auth_devise#225 Scenario: I should be able to reload the app after changing a user decorator Given I am logged in When I go to the the account page Then I should see the value of UserDecorator#decoration When I change the value the UserDecorator#decoration And I refresh the account page Then I should see the new value
1 parent 662bc64 commit ce1c7ef

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Rails6141Store
2+
module UserDecorator
3+
def decoration
4+
"This is the output of UserDecorator#decoration"
5+
end
6+
7+
Spree::User.prepend self
8+
end
9+
end

app/views/spree/users/show.html.erb

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<h1><%= accurate_title %></h1>
2+
3+
<%= spree_current_user.decoration %>
4+
5+
<div data-hook="account_summary" class="account-summary">
6+
<dl id="user-info">
7+
<dt><%= t('spree.email') %></dt>
8+
<dd><%= @user.email %> (<%= link_to t('spree.edit'), spree.edit_account_path %>)</dd>
9+
</dl>
10+
</div>
11+
12+
<div data-hook="account_my_orders" class="account-my-orders">
13+
14+
<h3><%= t('spree.my_orders') %></h3>
15+
<% if @orders.present? %>
16+
<table class="order-summary">
17+
<thead>
18+
<tr>
19+
<th class="order-number"><%= t(:number, scope: 'activerecord.attributes.spree/order') %></th>
20+
<th class="order-date"><%= t('spree.date') %></th>
21+
<th class="order-status"><%= t('spree.status') %></th>
22+
<th class="order-payment-state"><%= t('spree.payment_state') %></th>
23+
<th class="order-shipment-state"><%= t('spree.shipment_state') %></th>
24+
<th class="order-total"><%= t('spree.total') %></th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
<% @orders.each do |order| %>
29+
<tr class="<%= cycle('even', 'odd') %>">
30+
<td class="order-number"><%= link_to order.number, order_url(order) %></td>
31+
<td class="order-date"><%= l order.completed_at.to_date %></td>
32+
<td class="order-status"><%= t("spree.order_state.#{order.state}").titleize %></td>
33+
<td class="order-payment-state"><%= t("spree.payment_states.#{order.payment_state}").titleize if order.payment_state %></td>
34+
<td class="order-shipment-state"><%= t("spree.shipment_states.#{order.shipment_state}").titleize if order.shipment_state %></td>
35+
<td class="order-total"><%= order.display_total %></td>
36+
</tr>
37+
<% end %>
38+
</tbody>
39+
</table>
40+
<% else %>
41+
<p><%= t('spree.you_have_no_orders_yet') %></p>
42+
<% end %>
43+
<br />
44+
45+
</div>

0 commit comments

Comments
 (0)