Commit 5ad46e233ac8b0f3bb587a7e315d686f45c67e70
1 parent
1c390d09
Exists in
master
and in
29 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 | 145 | false |
| 146 | 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 | 148 | def has_basic_info? |
| 154 | 149 | %w[unit price discount].each do |field| |
| 155 | 150 | return true if !self.send(field).blank? | ... | ... |
app/views/catalog/index.rhtml
features/browse_catalogs.feature
| ... | ... | @@ -159,7 +159,7 @@ Feature: browse catalogs |
| 159 | 159 | When I click "product-description-button" |
| 160 | 160 | Then I should see "A small description" within "#product-description" |
| 161 | 161 | And the "product-description" should be visible |
| 162 | - When I click "product-description-button" | |
| 162 | + When I click "product-list" | |
| 163 | 163 | Then the "product-description" should not be visible |
| 164 | 164 | |
| 165 | 165 | Scenario: display unavailable product |
| ... | ... | @@ -190,40 +190,51 @@ Feature: browse catalogs |
| 190 | 190 | And I should see "Organic" within "span.search-product-qualifier" |
| 191 | 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 | 239 | @selenium |
| 229 | 240 | Scenario: display inputs and raw materials button when not completely filled |
| ... | ... | @@ -294,5 +305,5 @@ Feature: browse catalogs |
| 294 | 305 | When I click "#inputs-button" |
| 295 | 306 | Then the "#inputs-description" should be visible |
| 296 | 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 | 309 | Then the "#inputs-description" should not be visible | ... | ... |