Commit 5ad46e233ac8b0f3bb587a7e315d686f45c67e70
1 parent
1c390d09
Exists in
master
and in
28 other branches
Integration of AI1413 with AI2111
Showing
3 changed files
with
47 additions
and
41 deletions
Show diff stats
app/models/product.rb
@@ -145,11 +145,6 @@ class Product < ActiveRecord::Base | @@ -145,11 +145,6 @@ class Product < ActiveRecord::Base | ||
145 | false | 145 | false |
146 | end | 146 | end |
147 | 147 | ||
148 | - # FIXME this will check the validity of price composition with inputs and other costs | ||
149 | - def is_open_price? | ||
150 | - false | ||
151 | - end | ||
152 | - | ||
153 | def has_basic_info? | 148 | def has_basic_info? |
154 | %w[unit price discount].each do |field| | 149 | %w[unit price discount].each do |field| |
155 | return true if !self.send(field).blank? | 150 | return true if !self.send(field).blank? |
app/views/catalog/index.rhtml
@@ -50,7 +50,7 @@ | @@ -50,7 +50,7 @@ | ||
50 | </li> | 50 | </li> |
51 | <% end %> | 51 | <% end %> |
52 | 52 | ||
53 | - <% if product.is_open_price? %> | 53 | + <% if product.price_described? %> |
54 | <li class="product-price-composition expand-box"> | 54 | <li class="product-price-composition expand-box"> |
55 | <span id="product-price-composition-button"><%= _('price composition') %></span> | 55 | <span id="product-price-composition-button"><%= _('price composition') %></span> |
56 | <div> | 56 | <div> |
features/browse_catalogs.feature
@@ -159,7 +159,7 @@ Feature: browse catalogs | @@ -159,7 +159,7 @@ Feature: browse catalogs | ||
159 | When I click "product-description-button" | 159 | When I click "product-description-button" |
160 | Then I should see "A small description" within "#product-description" | 160 | Then I should see "A small description" within "#product-description" |
161 | And the "product-description" should be visible | 161 | And the "product-description" should be visible |
162 | - When I click "product-description-button" | 162 | + When I click "product-list" |
163 | Then the "product-description" should not be visible | 163 | Then the "product-description" should not be visible |
164 | 164 | ||
165 | Scenario: display unavailable product | 165 | Scenario: display unavailable product |
@@ -190,40 +190,51 @@ Feature: browse catalogs | @@ -190,40 +190,51 @@ Feature: browse catalogs | ||
190 | And I should see "Organic" within "span.search-product-qualifier" | 190 | And I should see "Organic" within "span.search-product-qualifier" |
191 | And I should not see "price composition" | 191 | And I should not see "price composition" |
192 | 192 | ||
193 | -#FIXME: this will only be available after AI1413 | ||
194 | -# @selenium | ||
195 | -# Scenario: display price composition button (but not inputs) | ||
196 | -# Given the following product | ||
197 | -# | owner | category | name | price | | ||
198 | -# | artebonito | food | Bananada | 10.00 | | ||
199 | -# And the following input | ||
200 | -# | product | category | price_per_unit | amount_used | | ||
201 | -# | Bananada | food | 0.99 | 5 | | ||
202 | -# And I am on /catalog/artebonito | ||
203 | -# And I reload and wait for the page | ||
204 | -# Then I should see "Bananada" within "li.product-link" | ||
205 | -# And I should see "10.00" within "span.product-price" | ||
206 | -# And I should see "price composition" within "#product-price-composition-button" | ||
207 | -# And the "#product-price-composition-button" should be visible | ||
208 | -# And I should see "food" within "#product-price-composition" | ||
209 | -# And I should see "4.95" within "#product-price-composition" | ||
210 | -# And the "#product-price-composition" should not be visible | 193 | + @selenium |
194 | + Scenario: not display price composition button if price is not described | ||
195 | + Given the following product | ||
196 | + | owner | category | name | price | | ||
197 | + | artebonito | food | Bananada | 10.00 | | ||
198 | + And the following input | ||
199 | + | product | category | price_per_unit | amount_used | | ||
200 | + | Bananada | food | 0.99 | 5 | | ||
201 | + And I am on /catalog/artebonito | ||
202 | + And I reload and wait for the page | ||
203 | + Then I should see "Bananada" within "li.product-link" | ||
204 | + And I should see "10.00" within "span.product-price" | ||
205 | + And the "#product-price-composition-button" should not be visible | ||
211 | 206 | ||
212 | -#FIXME: this will only be available after AI1413 | ||
213 | -# @selenium | ||
214 | -# Scenario: display price composition when button is clicked | ||
215 | -# Given the following product | ||
216 | -# | owner | category | name | price | | ||
217 | -# | artebonito | food | Bananada | 10.00 | | ||
218 | -# And the following input | ||
219 | -# | product | category | price_per_unit | amount_used | | ||
220 | -# | Bananada | food | 0.99 | 5 | | ||
221 | -# And I am on /catalog/artebonito | ||
222 | -# And I reload and wait for the page | ||
223 | -# When I click "#product-price-composition-button" | ||
224 | -# Then the "#product-price-composition" should be visible | ||
225 | -# And I should see "food" within "#product-price-composition" | ||
226 | -# And I should see "4.95" within "#product-price-composition" | 207 | + @selenium |
208 | + Scenario: display price composition button (but not inputs) | ||
209 | + Given the following product | ||
210 | + | owner | category | name | price | | ||
211 | + | artebonito | food | Bananada | 10.00 | | ||
212 | + And the following input | ||
213 | + | product | category | price_per_unit | amount_used | | ||
214 | + | Bananada | food | 2.00 | 5 | | ||
215 | + And I am on /catalog/artebonito | ||
216 | + And I reload and wait for the page | ||
217 | + Then I should see "Bananada" within "li.product-link" | ||
218 | + And I should see "10.00" within "span.product-price" | ||
219 | + And I should see "price composition" within "#product-price-composition-button" | ||
220 | + And the "#product-price-composition-button" should be visible | ||
221 | + And I should see "food" within "#product-price-composition" | ||
222 | + And I should see "10.00" within "#product-price-composition" | ||
223 | + | ||
224 | + @selenium | ||
225 | + Scenario: display price composition when button is clicked | ||
226 | + Given the following product | ||
227 | + | owner | category | name | price | | ||
228 | + | artebonito | food | Bananada | 10.88 | | ||
229 | + And the following input | ||
230 | + | product | category | price_per_unit | amount_used | | ||
231 | + | Bananada | food | 2.72 | 4 | | ||
232 | + And I am on /catalog/artebonito | ||
233 | + And I reload and wait for the page | ||
234 | + When I click "#product-price-composition-button" | ||
235 | + Then the "#product-price-composition" should be visible | ||
236 | + And I should see "food" within "#product-price-composition" | ||
237 | + And I should see "10.88" within "#product-price-composition" | ||
227 | 238 | ||
228 | @selenium | 239 | @selenium |
229 | Scenario: display inputs and raw materials button when not completely filled | 240 | Scenario: display inputs and raw materials button when not completely filled |
@@ -294,5 +305,5 @@ Feature: browse catalogs | @@ -294,5 +305,5 @@ Feature: browse catalogs | ||
294 | When I click "#inputs-button" | 305 | When I click "#inputs-button" |
295 | Then the "#inputs-description" should be visible | 306 | Then the "#inputs-description" should be visible |
296 | And I should see "7.0 Liter of food" within "#inputs-description" | 307 | And I should see "7.0 Liter of food" within "#inputs-description" |
297 | - When I click "#inputs-button" | 308 | + When I click "#product-list" |
298 | Then the "#inputs-description" should not be visible | 309 | Then the "#inputs-description" should not be visible |