Commit 8adbc64fade1c7380ff72eef507ff7ba803f2da4
1 parent
321010ae
Exists in
master
and in
22 other branches
Fixed some broken tests
Showing
7 changed files
with
27 additions
and
15 deletions
Show diff stats
app/models/product.rb
| @@ -184,7 +184,7 @@ class Product < ActiveRecord::Base | @@ -184,7 +184,7 @@ class Product < ActiveRecord::Base | ||
| 184 | end | 184 | end |
| 185 | 185 | ||
| 186 | def price_described? | 186 | def price_described? |
| 187 | - return false if price.nil? | 187 | + return false if price.blank? or price == 0 |
| 188 | (price - total_production_cost).zero? | 188 | (price - total_production_cost).zero? |
| 189 | end | 189 | end |
| 190 | 190 |
features/browse_catalogs.feature
| @@ -73,6 +73,19 @@ Feature: browse catalogs | @@ -73,6 +73,19 @@ Feature: browse catalogs | ||
| 73 | And I should not see "qualifiers" | 73 | And I should not see "qualifiers" |
| 74 | And I should not see "price composition" | 74 | And I should not see "price composition" |
| 75 | 75 | ||
| 76 | + Scenario: don't display the price when it's not defined | ||
| 77 | + Given the following products | ||
| 78 | + | owner | category | name | | ||
| 79 | + | artebonito | categ1 | Produto1 | | ||
| 80 | + And I am on /catalog/artebonito | ||
| 81 | + Then I should see "Produto1" within "li.product-link" | ||
| 82 | + And I should not see "0.00" | ||
| 83 | + And I should see "No image" within ".no-image" | ||
| 84 | + And I should not see "product unavailable" | ||
| 85 | + And I should not see "description" | ||
| 86 | + And I should not see "qualifiers" | ||
| 87 | + And I should not see "price composition" | ||
| 88 | + | ||
| 76 | Scenario: product name links to product page | 89 | Scenario: product name links to product page |
| 77 | Given the following products | 90 | Given the following products |
| 78 | | owner | category | name | price | | 91 | | owner | category | name | price | |
features/delete_profile.feature
| @@ -16,7 +16,7 @@ Feature: delete profile | @@ -16,7 +16,7 @@ Feature: delete profile | ||
| 16 | Scenario: deleting profile | 16 | Scenario: deleting profile |
| 17 | Given I am logged in as "joaosilva" | 17 | Given I am logged in as "joaosilva" |
| 18 | And I am on Joao Silva's control panel | 18 | And I am on Joao Silva's control panel |
| 19 | - And I follow "Profile Info and settings" | 19 | + And I follow "Edit Profile" |
| 20 | And I follow "Delete profile" | 20 | And I follow "Delete profile" |
| 21 | Then I should see "Are you sure you want to delete this profile?" | 21 | Then I should see "Are you sure you want to delete this profile?" |
| 22 | When I follow "Yes, I am sure" | 22 | When I follow "Yes, I am sure" |
| @@ -32,7 +32,7 @@ Feature: delete profile | @@ -32,7 +32,7 @@ Feature: delete profile | ||
| 32 | Scenario: giving up of deleting profile | 32 | Scenario: giving up of deleting profile |
| 33 | Given I am logged in as "joaosilva" | 33 | Given I am logged in as "joaosilva" |
| 34 | And I am on Joao Silva's control panel | 34 | And I am on Joao Silva's control panel |
| 35 | - And I follow "Profile Info and settings" | 35 | + And I follow "Edit Profile" |
| 36 | And I follow "Delete profile" | 36 | And I follow "Delete profile" |
| 37 | Then I should see "Are you sure you want to delete this profile?" | 37 | Then I should see "Are you sure you want to delete this profile?" |
| 38 | When I follow "No, I gave up" | 38 | When I follow "No, I gave up" |
| @@ -108,7 +108,7 @@ Feature: delete profile | @@ -108,7 +108,7 @@ Feature: delete profile | ||
| 108 | Scenario: environment admin deletes profile | 108 | Scenario: environment admin deletes profile |
| 109 | Given I am logged in as admin | 109 | Given I am logged in as admin |
| 110 | And I am on Joao Silva's control panel | 110 | And I am on Joao Silva's control panel |
| 111 | - And I follow "Profile Info and settings" | 111 | + And I follow "Edit Profile" |
| 112 | And I follow "Delete profile" | 112 | And I follow "Delete profile" |
| 113 | Then I should see "Are you sure you want to delete this profile?" | 113 | Then I should see "Are you sure you want to delete this profile?" |
| 114 | When I follow "Yes, I am sure" | 114 | When I follow "Yes, I am sure" |
features/edit_article.feature
| @@ -91,7 +91,7 @@ Feature: edit article | @@ -91,7 +91,7 @@ Feature: edit article | ||
| 91 | Given I am on Joao Silva's sitemap | 91 | Given I am on Joao Silva's sitemap |
| 92 | When I follow "Save the whales" and wait | 92 | When I follow "Save the whales" and wait |
| 93 | And I follow "Edit" and wait | 93 | And I follow "Edit" and wait |
| 94 | - And I follow "Cancel" within ".main-block" and wait | 94 | + And I follow "Cancel" and wait |
| 95 | Then I should be on /joaosilva/save-the-whales | 95 | Then I should be on /joaosilva/save-the-whales |
| 96 | 96 | ||
| 97 | @selenium | 97 | @selenium |
features/edit_profile.feature
| @@ -11,7 +11,7 @@ Feature: edit profile | @@ -11,7 +11,7 @@ Feature: edit profile | ||
| 11 | | display_name | | 11 | | display_name | |
| 12 | | birth_date | | 12 | | birth_date | |
| 13 | When I go to joao's control panel | 13 | When I go to joao's control panel |
| 14 | - And I follow "Profile Info and settings" | 14 | + And I follow "Edit Profile" |
| 15 | And I select "November" | 15 | And I select "November" |
| 16 | And I select "15" | 16 | And I select "15" |
| 17 | And I press "Save" | 17 | And I press "Save" |
| @@ -23,7 +23,7 @@ Feature: edit profile | @@ -23,7 +23,7 @@ Feature: edit profile | ||
| 23 | | display_name | | 23 | | display_name | |
| 24 | | birth_date | | 24 | | birth_date | |
| 25 | When I go to joao's control panel | 25 | When I go to joao's control panel |
| 26 | - And I follow "Profile Info and settings" | 26 | + And I follow "Edit Profile" |
| 27 | And I select "November" | 27 | And I select "November" |
| 28 | And I select "15" | 28 | And I select "15" |
| 29 | And I press "Save" | 29 | And I press "Save" |
| @@ -35,7 +35,7 @@ Feature: edit profile | @@ -35,7 +35,7 @@ Feature: edit profile | ||
| 35 | | display_name | | 35 | | display_name | |
| 36 | | birth_date | | 36 | | birth_date | |
| 37 | When I go to joao's control panel | 37 | When I go to joao's control panel |
| 38 | - And I follow "Profile Info and settings" | 38 | + And I follow "Edit Profile" |
| 39 | And I select "November" | 39 | And I select "November" |
| 40 | And I select "15" | 40 | And I select "15" |
| 41 | And I select "1980" | 41 | And I select "1980" |
| @@ -48,7 +48,7 @@ Feature: edit profile | @@ -48,7 +48,7 @@ Feature: edit profile | ||
| 48 | | display_name | | 48 | | display_name | |
| 49 | | birth_date | | 49 | | birth_date | |
| 50 | When I go to joao's control panel | 50 | When I go to joao's control panel |
| 51 | - And I follow "Profile Info and settings" | 51 | + And I follow "Edit Profile" |
| 52 | And I select "November" | 52 | And I select "November" |
| 53 | And I select "15" | 53 | And I select "15" |
| 54 | And I select "1980" | 54 | And I select "1980" |
features/manage_product_price_details.feature
| @@ -80,7 +80,7 @@ Feature: manage product price details | @@ -80,7 +80,7 @@ Feature: manage product price details | ||
| 80 | And I should not see "Taxes" within "#display-price-details" | 80 | And I should not see "Taxes" within "#display-price-details" |
| 81 | And I should see "Energy" within "#display-price-details" | 81 | And I should see "Energy" within "#display-price-details" |
| 82 | 82 | ||
| 83 | - Scenario: not display product detail button if product does not have input | 83 | + Scenario: not display price composition if product does not have input |
| 84 | Given the following product | 84 | Given the following product |
| 85 | | owner | category | name | | 85 | | owner | category | name | |
| 86 | | redemoinho | rock | Yellow Submarine | | 86 | | redemoinho | rock | Yellow Submarine | |
| @@ -89,13 +89,12 @@ Feature: manage product price details | @@ -89,13 +89,12 @@ Feature: manage product price details | ||
| 89 | | mariasouza | Maria Souza | | 89 | | mariasouza | Maria Souza | |
| 90 | And I am logged in as "mariasouza" | 90 | And I am logged in as "mariasouza" |
| 91 | When I go to Rede Moinho's page of product Yellow Submarine | 91 | When I go to Rede Moinho's page of product Yellow Submarine |
| 92 | - And I follow "Price composition" | ||
| 93 | - Then I should not see "Describe here the cost of production" | 92 | + Then I should not see "Price composition" |
| 94 | 93 | ||
| 95 | - Scenario: not display price details if price is not fully described | 94 | + Scenario: not display price composition if price is not fully described |
| 96 | Given I am not logged in | 95 | Given I am not logged in |
| 97 | And I go to Rede Moinho's page of product Abbey Road | 96 | And I go to Rede Moinho's page of product Abbey Road |
| 98 | - Then I should not see "60.0" | 97 | + Then I should not see "Price composition" |
| 99 | 98 | ||
| 100 | @selenium | 99 | @selenium |
| 101 | Scenario: display price details if price is fully described | 100 | Scenario: display price details if price is fully described |
features/signup.feature
| @@ -53,7 +53,7 @@ Feature: signup | @@ -53,7 +53,7 @@ Feature: signup | ||
| 53 | | joaosilva | Joao Silva | | 53 | | joaosilva | Joao Silva | |
| 54 | Given I am logged in as "joaosilva" | 54 | Given I am logged in as "joaosilva" |
| 55 | And I am on Joao Silva's control panel | 55 | And I am on Joao Silva's control panel |
| 56 | - And I follow "Profile Info and settings" | 56 | + And I follow "Edit Profile" |
| 57 | And I fill in "Name" with "" | 57 | And I fill in "Name" with "" |
| 58 | When I press "Save" | 58 | When I press "Save" |
| 59 | Then I should see "Name can't be blank" | 59 | Then I should see "Name can't be blank" |