radiant-shop-extension 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -3
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/app/controllers/admin/shop/customers_controller.rb +35 -126
- data/app/controllers/shop/categories_controller.rb +1 -5
- data/app/controllers/shop/products_controller.rb +1 -1
- data/app/models/form_checkout.rb +198 -112
- data/app/models/shop_category.rb +3 -3
- data/app/models/shop_customer.rb +3 -12
- data/app/models/shop_order.rb +5 -3
- data/app/models/shop_payment.rb +0 -1
- data/app/models/shop_product.rb +3 -3
- data/app/views/admin/shop/customers/edit.html.haml +13 -0
- data/app/views/admin/shop/customers/edit/_fields.html.haml +33 -0
- data/app/views/admin/shop/customers/edit/_head.html.haml +2 -0
- data/app/views/admin/shop/customers/edit/_meta.html.haml +7 -0
- data/app/views/admin/shop/customers/edit/_parts.html.haml +4 -0
- data/app/views/admin/shop/customers/edit/_popups.html.haml +3 -0
- data/app/views/admin/shop/customers/edit/meta/_login.html.haml +5 -0
- data/app/views/admin/shop/customers/edit/meta/_password.html.haml +5 -0
- data/app/views/admin/shop/customers/edit/meta/_password_confirmation.html.haml +5 -0
- data/app/views/admin/shop/customers/edit/parts/_address.html.haml +7 -0
- data/app/views/admin/shop/customers/edit/parts/_addresses.html.haml +13 -0
- data/app/views/admin/shop/customers/edit/parts/_orders.html.haml +29 -0
- data/app/views/admin/shop/customers/index.html.haml +9 -35
- data/app/views/admin/shop/customers/index/_bottom.html.haml +4 -0
- data/app/views/admin/shop/customers/index/_customer.html.haml +9 -0
- data/app/views/admin/shop/customers/new.html.haml +11 -0
- data/app/views/admin/shop/customers/remove.html.haml +12 -0
- data/app/views/admin/shop/products/new.html.haml +1 -1
- data/config/locales/en.yml +37 -29
- data/config/routes.rb +2 -0
- data/db/migrate/20100927041219_remove_payment_methods.rb +16 -0
- data/db/migrate/20100927041624_change_payments_add_gateway.rb +11 -0
- data/db/migrate/20100927140446_change_payment_add_card_type_card_number.rb +11 -0
- data/db/seed.rb +1 -0
- data/db/seeds/forms.rb +179 -0
- data/db/{migrate/20100520033059_create_layouts.rb → seeds/layouts.rb} +19 -27
- data/db/seeds/snippets.rb +23 -0
- data/lib/shop/interface/customers.rb +34 -0
- data/lib/shop/tags/address.rb +1 -0
- data/lib/shop/tags/card.rb +51 -0
- data/lib/shop/tags/helpers.rb +53 -38
- data/lib/shop/tags/item.rb +1 -1
- data/lib/shop/tags/product.rb +23 -22
- data/lib/shop/tags/responses.rb +3 -3
- data/lib/tasks/shop_extension_tasks.rake +6 -0
- data/public/stylesheets/sass/admin/extensions/shop/index.sass +64 -0
- data/radiant-shop-extension.gemspec +37 -6
- data/shop_extension.rb +7 -2
- data/spec/datasets/forms.rb +112 -118
- data/spec/datasets/shop_customers.rb +30 -0
- data/spec/datasets/shop_orders.rb +7 -3
- data/spec/datasets/shop_products.rb +1 -0
- data/spec/lib/shop/tags/card_spec.rb +71 -0
- data/spec/lib/shop/tags/helpers_spec.rb +270 -283
- data/spec/lib/shop/tags/item_spec.rb +9 -0
- data/spec/lib/shop/tags/product_spec.rb +172 -158
- data/spec/lib/shop/tags/responses_spec.rb +129 -0
- data/spec/models/form_checkout_spec.rb +228 -294
- data/spec/models/shop_category_page_spec.rb +2 -2
- data/spec/models/shop_order_spec.rb +27 -20
- data/spec/models/shop_product_attachment_spec.rb +1 -0
- metadata +61 -17
- data/app/models/shop_payment_method.rb +0 -5
- data/db/migrate/20100903122123_create_forms.rb +0 -44
- data/db/migrate/20100908063639_create_snippets.rb +0 -22
@@ -18,6 +18,7 @@ describe Shop::Tags::Item do
|
|
18
18
|
'shop:cart:item:id',
|
19
19
|
'shop:cart:item:quantity',
|
20
20
|
'shop:cart:item:name',
|
21
|
+
'shop:cart:item:sku',
|
21
22
|
'shop:cart:item:link',
|
22
23
|
'shop:cart:item:price',
|
23
24
|
'shop:cart:item:weight',
|
@@ -204,6 +205,14 @@ describe Shop::Tags::Item do
|
|
204
205
|
|
205
206
|
@page.should render(tag).as(expected)
|
206
207
|
end
|
208
|
+
it 'should render <r:sku />' do
|
209
|
+
stub(@shop_line_item).item.stub!.sku { 'sku' }
|
210
|
+
|
211
|
+
tag = %{<r:shop:cart:item:sku />}
|
212
|
+
expected = %{sku}
|
213
|
+
|
214
|
+
@page.should render(tag).as(expected)
|
215
|
+
end
|
207
216
|
it 'should render <r:weight />' do
|
208
217
|
stub(@shop_line_item).item.stub!.weight { 100 }
|
209
218
|
|
@@ -2,7 +2,7 @@ require 'spec/spec_helper'
|
|
2
2
|
|
3
3
|
describe Shop::Tags::Product do
|
4
4
|
|
5
|
-
dataset :pages
|
5
|
+
dataset :pages, :shop_products
|
6
6
|
|
7
7
|
it 'should describe these tags' do
|
8
8
|
Shop::Tags::Product.tags.sort.should == [
|
@@ -18,313 +18,327 @@ describe Shop::Tags::Product do
|
|
18
18
|
'shop:product:slug',
|
19
19
|
'shop:product:description',
|
20
20
|
'shop:product:link',
|
21
|
-
'shop:product:if_images',
|
22
|
-
'shop:product:unless_images',
|
23
21
|
'shop:product:images',
|
22
|
+
'shop:product:images:if_images',
|
23
|
+
'shop:product:images:unless_images',
|
24
24
|
'shop:product:images:each'].sort
|
25
25
|
end
|
26
|
+
|
27
|
+
before :all do
|
28
|
+
@page = pages(:home)
|
29
|
+
end
|
26
30
|
|
27
31
|
before(:each) do
|
28
|
-
product
|
29
|
-
|
30
|
-
|
31
|
-
@shop_product = product
|
32
|
-
@shop_products = [ product, product, product ]
|
32
|
+
@product = shop_products(:soft_bread)
|
33
|
+
@products = [ shop_products(:soft_bread), shop_products(:crusty_bread) ]
|
33
34
|
|
34
|
-
image
|
35
|
-
|
36
|
-
|
37
|
-
@image = image
|
38
|
-
@images = [ image, image, image ]
|
35
|
+
@image = images(:soft_bread_front)
|
36
|
+
@images = [ images(:soft_bread_front), images(:soft_bread_back), images(:soft_bread_top) ]
|
39
37
|
end
|
40
38
|
|
41
39
|
describe '<r:shop:if_products>' do
|
42
40
|
context 'success' do
|
41
|
+
before :each do
|
42
|
+
mock(Shop::Tags::Helpers).current_products(anything) { @products }
|
43
|
+
end
|
44
|
+
|
43
45
|
it 'should render' do
|
44
|
-
mock(Shop::Tags::Helpers).current_products(anything) { @shop_products }
|
45
|
-
|
46
46
|
tag = %{<r:shop:if_products>success</r:shop:if_products>}
|
47
|
-
|
48
|
-
|
47
|
+
exp = %{success}
|
48
|
+
@page.should render(tag).as(exp)
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
51
52
|
context 'failure' do
|
52
|
-
|
53
|
+
before :each do
|
53
54
|
mock(Shop::Tags::Helpers).current_products(anything) { [] }
|
54
|
-
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should not render' do
|
55
58
|
tag = %{<r:shop:if_products>failure</r:shop:if_products>}
|
56
|
-
|
57
|
-
|
59
|
+
exp = %{}
|
60
|
+
@page.should render(tag).as(exp)
|
58
61
|
end
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
62
65
|
describe '<r:shop:unless_products>' do
|
63
66
|
context 'success' do
|
64
|
-
|
67
|
+
before :each do
|
65
68
|
mock(Shop::Tags::Helpers).current_products(anything) { [] }
|
66
|
-
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should render' do
|
67
72
|
tag = %{<r:shop:unless_products>success</r:shop:unless_products>}
|
68
|
-
|
69
|
-
|
73
|
+
exp = %{success}
|
74
|
+
@page.should render(tag).as(exp)
|
70
75
|
end
|
71
76
|
end
|
77
|
+
|
72
78
|
context 'failure' do
|
79
|
+
before :each do
|
80
|
+
mock(Shop::Tags::Helpers).current_products(anything) { @products }
|
81
|
+
end
|
82
|
+
|
73
83
|
it 'should not render' do
|
74
|
-
mock(Shop::Tags::Helpers).current_products(anything) { @shop_products }
|
75
|
-
|
76
84
|
tag = %{<r:shop:unless_products>failure</r:shop:unless_products>}
|
77
|
-
|
78
|
-
|
85
|
+
exp = %{}
|
86
|
+
@page.should render(tag).as(exp)
|
79
87
|
end
|
80
88
|
end
|
81
89
|
end
|
82
90
|
|
83
91
|
describe '<r:shop:products>' do
|
84
|
-
|
85
|
-
|
86
|
-
|
92
|
+
context 'no products exist' do
|
93
|
+
before :each do
|
94
|
+
mock(Shop::Tags::Helpers).current_products(anything) { [] }
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should render' do
|
98
|
+
tag = %{<r:shop:products>success</r:shop:products>}
|
99
|
+
exp = %{success}
|
100
|
+
|
101
|
+
@page.should render(tag).as(exp)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'products exist' do
|
106
|
+
before :each do
|
107
|
+
mock(Shop::Tags::Helpers).current_products(anything) { @products }
|
108
|
+
end
|
87
109
|
|
88
|
-
|
110
|
+
it 'should render' do
|
111
|
+
tag = %{<r:shop:products>success</r:shop:products>}
|
112
|
+
exp = %{success}
|
113
|
+
|
114
|
+
@page.should render(tag).as(exp)
|
115
|
+
end
|
89
116
|
end
|
90
117
|
end
|
91
118
|
|
92
119
|
describe '<r:shop:products:each>' do
|
93
120
|
context 'success' do
|
121
|
+
before :each do
|
122
|
+
mock(Shop::Tags::Helpers).current_products(anything) { @products }
|
123
|
+
end
|
124
|
+
|
94
125
|
it 'should not render' do
|
95
|
-
|
96
|
-
|
97
|
-
tag
|
98
|
-
expected = %{.a..a..a.}
|
99
|
-
pages(:home).should render(tag).as(expected)
|
126
|
+
tag = %{<r:shop:products:each><r:product:id /></r:shop:products:each>}
|
127
|
+
exp = @products.map{ |p| p.id }.join('')
|
128
|
+
@page.should render(tag).as(exp)
|
100
129
|
end
|
101
130
|
end
|
131
|
+
|
102
132
|
context 'failure' do
|
103
|
-
|
133
|
+
before :each do
|
104
134
|
mock(Shop::Tags::Helpers).current_products(anything) { [] }
|
105
|
-
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'should not render' do
|
106
138
|
tag = %{<r:shop:products:each>failure</r:shop:products:each>}
|
107
|
-
|
108
|
-
|
139
|
+
exp = %{}
|
140
|
+
@page.should render(tag).as(exp)
|
109
141
|
end
|
110
142
|
end
|
111
143
|
end
|
112
144
|
|
113
145
|
describe '<r:shop:product>' do
|
114
|
-
context '
|
146
|
+
context 'product exists in the context' do
|
147
|
+
before :each do
|
148
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @products }
|
149
|
+
end
|
150
|
+
|
115
151
|
it 'should render' do
|
116
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @shop_product }
|
117
|
-
|
118
152
|
tag = %{<r:shop:product>success</r:shop:product>}
|
119
|
-
|
120
|
-
|
153
|
+
exp = %{success}
|
154
|
+
@page.should render(tag).as(exp)
|
121
155
|
end
|
122
156
|
end
|
123
|
-
|
157
|
+
|
158
|
+
context 'product does not exist in the context' do
|
159
|
+
before :each do
|
160
|
+
mock(Shop::Tags::Helpers).current_product(anything) { [] }
|
161
|
+
end
|
162
|
+
|
124
163
|
it 'should not render' do
|
125
|
-
mock(Shop::Tags::Helpers).current_product(anything) { nil }
|
126
|
-
|
127
164
|
tag = %{<r:shop:product>failure</r:shop:product>}
|
128
|
-
|
129
|
-
|
165
|
+
exp = %{}
|
166
|
+
@page.should render(tag).as(exp)
|
130
167
|
end
|
131
168
|
end
|
132
169
|
|
133
|
-
|
170
|
+
context '#attributes' do
|
134
171
|
before :each do
|
135
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
136
|
-
end
|
137
|
-
it 'should render <r:id />' do
|
138
|
-
stub(@shop_product).id { 1 }
|
139
|
-
|
140
|
-
tag = %{<r:shop:product:id />}
|
141
|
-
expected = %{1}
|
142
|
-
pages(:home).should render(tag).as(expected)
|
143
|
-
end
|
144
|
-
it 'should render <r:name />' do
|
145
|
-
stub(@shop_product).name { 'name' }
|
146
|
-
|
147
|
-
tag = %{<r:shop:product:name />}
|
148
|
-
expected = %{name}
|
149
|
-
pages(:home).should render(tag).as(expected)
|
150
|
-
end
|
151
|
-
it 'should render <r:sku />' do
|
152
|
-
stub(@shop_product).sku { 'sku' }
|
153
|
-
|
154
|
-
tag = %{<r:shop:product:sku />}
|
155
|
-
expected = %{sku}
|
156
|
-
pages(:home).should render(tag).as(expected)
|
157
|
-
end
|
158
|
-
it 'should render <r:slug />' do
|
159
|
-
stub(@shop_product).slug { 'slug' }
|
160
|
-
|
161
|
-
tag = %{<r:shop:product:slug />}
|
162
|
-
expected = %{slug}
|
163
|
-
pages(:home).should render(tag).as(expected)
|
172
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
164
173
|
end
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
174
|
+
|
175
|
+
describe '<r:id />' do
|
176
|
+
it 'should render the product id' do
|
177
|
+
tag = %{<r:shop:product:id />}
|
178
|
+
exp = @product.id.to_s
|
179
|
+
@page.should render(tag).as(exp)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
describe '<r:name />' do
|
183
|
+
it 'should render the product name' do
|
184
|
+
tag = %{<r:shop:product:name />}
|
185
|
+
exp = @product.name
|
186
|
+
@page.should render(tag).as(exp)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
describe '<r:sku />' do
|
190
|
+
it 'should render the product sku' do
|
191
|
+
tag = %{<r:shop:product:sku />}
|
192
|
+
exp = @product.sku
|
193
|
+
@page.should render(tag).as(exp)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
describe '<r:slug />' do
|
197
|
+
it 'should render the product slug' do
|
198
|
+
tag = %{<r:shop:product:slug />}
|
199
|
+
exp = @product.slug
|
200
|
+
@page.should render(tag).as(exp)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
describe '<r:description />' do
|
204
|
+
it 'should render a textile filtered description' do
|
205
|
+
tag = %{<r:shop:product:description />}
|
206
|
+
exp = TextileFilter.filter(@product.description)
|
207
|
+
@page.should render(tag).as(exp)
|
208
|
+
end
|
175
209
|
end
|
176
210
|
end
|
177
211
|
|
178
212
|
describe '<r:link />' do
|
179
213
|
before :each do
|
180
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
214
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
181
215
|
end
|
182
216
|
|
183
217
|
context 'standalone' do
|
184
|
-
before :each do
|
185
|
-
stub(@shop_product).slug { 'slug' }
|
186
|
-
stub(@shop_product).name { 'name' }
|
187
|
-
end
|
188
218
|
it 'should render an anchor element' do
|
189
219
|
tag = %{<r:shop:product:link />}
|
190
|
-
|
191
|
-
|
220
|
+
exp = %{<a href="#{@product.slug}">#{@product.name}</a>}
|
221
|
+
@page.should render(tag).as(exp)
|
192
222
|
end
|
193
223
|
it 'should assign attributes' do
|
194
224
|
tag = %{<r:shop:product:link title="title" data-title="data-title"/>}
|
195
|
-
|
196
|
-
|
225
|
+
exp = %{<a href="#{@product.slug}" data-title="data-title" title="title">#{@product.name}</a>}
|
226
|
+
@page.should render(tag).as(exp)
|
197
227
|
end
|
198
228
|
end
|
199
229
|
|
200
230
|
context 'wrapped' do
|
201
231
|
it 'should render an anchor element' do
|
202
|
-
stub(@shop_product).slug { 'slug' }
|
203
|
-
|
204
232
|
tag = %{<r:shop:product:link>title</r:shop:product:link>}
|
205
|
-
|
206
|
-
|
233
|
+
exp = %{<a href="#{@product.slug}">title</a>}
|
234
|
+
@page.should render(tag).as(exp)
|
207
235
|
end
|
208
236
|
end
|
209
237
|
end
|
210
238
|
|
211
239
|
describe '<r:price />' do
|
212
240
|
before :each do
|
213
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
214
|
-
stub(@
|
241
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
242
|
+
stub(@product).price { 1234.34567890 }
|
215
243
|
end
|
216
244
|
|
217
245
|
it 'should render a standard price' do
|
218
246
|
tag = %{<r:shop:product:price />}
|
219
|
-
|
220
|
-
|
247
|
+
exp = %{$1,234.35}
|
248
|
+
@page.should render(tag).as(exp)
|
221
249
|
end
|
222
250
|
|
223
251
|
it 'should render a high precision price' do
|
224
252
|
tag = %{<r:shop:product:price precision="8"/>}
|
225
|
-
|
226
|
-
|
253
|
+
exp = %{$1,234.34567890}
|
254
|
+
@page.should render(tag).as(exp)
|
227
255
|
end
|
228
256
|
|
229
257
|
it 'should render a custom format' do
|
230
258
|
tag = %{<r:shop:product:price unit="%" separator="-" delimiter="+" />}
|
231
|
-
|
232
|
-
|
259
|
+
exp = %{%1+234-35}
|
260
|
+
@page.should render(tag).as(exp)
|
233
261
|
end
|
234
262
|
end
|
235
263
|
|
236
|
-
describe '<r:shop:product:if_images>' do
|
264
|
+
describe '<r:shop:product:images:if_images>' do
|
237
265
|
before :each do
|
238
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
266
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
239
267
|
end
|
240
268
|
|
241
269
|
context 'success' do
|
242
270
|
it 'should render' do
|
243
|
-
|
244
|
-
|
245
|
-
tag
|
246
|
-
expected = %{success}
|
247
|
-
pages(:home).should render(tag).as(expected)
|
271
|
+
tag = %{<r:shop:product:images:if_images>success</r:shop:product:images:if_images>}
|
272
|
+
exp = %{success}
|
273
|
+
@page.should render(tag).as(exp)
|
248
274
|
end
|
249
275
|
end
|
250
|
-
|
251
276
|
context 'failure' do
|
252
277
|
it 'should not render' do
|
253
|
-
|
254
|
-
|
255
|
-
tag = %{<r:shop:product:if_images>failure</r:shop:product:if_images>}
|
256
|
-
|
257
|
-
|
278
|
+
@product.images.delete_all
|
279
|
+
|
280
|
+
tag = %{<r:shop:product:images:if_images>failure</r:shop:product:images:if_images>}
|
281
|
+
exp = %{}
|
282
|
+
@page.should render(tag).as(exp)
|
258
283
|
end
|
259
284
|
end
|
260
285
|
end
|
261
286
|
|
262
|
-
describe '<r:shop:product:unless_images>' do
|
287
|
+
describe '<r:shop:product:images:unless_images>' do
|
263
288
|
before :each do
|
264
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
289
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
265
290
|
end
|
266
291
|
|
267
292
|
context 'success' do
|
268
293
|
it 'should render' do
|
269
|
-
|
294
|
+
@product.images.delete_all
|
270
295
|
|
271
|
-
tag = %{<r:shop:product:unless_images>success</r:shop:product:unless_images>}
|
272
|
-
|
273
|
-
|
296
|
+
tag = %{<r:shop:product:images:unless_images>success</r:shop:product:images:unless_images>}
|
297
|
+
exp = %{success}
|
298
|
+
@page.should render(tag).as(exp)
|
274
299
|
end
|
275
300
|
end
|
276
301
|
|
277
302
|
context 'failure' do
|
278
303
|
it 'should not render' do
|
279
|
-
|
280
|
-
|
281
|
-
tag
|
282
|
-
expected = %{}
|
283
|
-
pages(:home).should render(tag).as(expected)
|
304
|
+
tag = %{<r:shop:product:images:unless_images>failure</r:shop:product:images:unless_images>}
|
305
|
+
exp = %{}
|
306
|
+
@page.should render(tag).as(exp)
|
284
307
|
end
|
285
308
|
end
|
286
309
|
end
|
287
310
|
|
288
311
|
describe '<r:shop:product:images>' do
|
289
312
|
before :each do
|
290
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
313
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
291
314
|
end
|
315
|
+
|
292
316
|
it 'should render' do
|
293
317
|
tag = %{<r:shop:product:images>success</r:shop:product:images>}
|
294
|
-
|
295
|
-
|
296
|
-
pages(:home).should render(tag).as(expected)
|
318
|
+
exp = %{success}
|
319
|
+
@page.should render(tag).as(exp)
|
297
320
|
end
|
298
321
|
end
|
299
322
|
|
300
323
|
describe '<r:shop:product:images:each>' do
|
301
324
|
before :each do
|
302
|
-
mock(Shop::Tags::Helpers).current_product(anything) { @
|
325
|
+
mock(Shop::Tags::Helpers).current_product(anything) { @product }
|
303
326
|
end
|
327
|
+
|
304
328
|
context 'success' do
|
305
|
-
|
306
|
-
stub(@shop_product).images { @images }
|
307
|
-
end
|
308
|
-
it 'should render' do
|
309
|
-
tag = %{<r:shop:product:images:each>.a.</r:shop:product:images:each>}
|
310
|
-
expected = %{.a..a..a.}
|
311
|
-
|
312
|
-
pages(:home).should render(tag).as(expected)
|
313
|
-
end
|
314
|
-
it 'should assign the local image' do
|
329
|
+
it 'should assign the local image for each' do
|
315
330
|
tag = %{<r:shop:product:images:each><r:image:id /></r:shop:product:images:each>}
|
316
|
-
|
317
|
-
|
318
|
-
pages(:home).should render(tag).as(expected)
|
331
|
+
exp = @product.attachments.map{ |i| i.id }.join('')
|
332
|
+
@page.should render(tag).as(exp)
|
319
333
|
end
|
320
334
|
end
|
321
335
|
context 'failure' do
|
322
336
|
it 'should not render' do
|
323
|
-
|
337
|
+
@product.images.delete_all
|
324
338
|
|
325
339
|
tag = %{<r:shop:product:images:each>failure</r:shop:product:images:each>}
|
326
|
-
|
327
|
-
|
340
|
+
exp = %{}
|
341
|
+
@page.should render(tag).as(exp)
|
328
342
|
end
|
329
343
|
end
|
330
344
|
end
|