Commit 8adbc64fade1c7380ff72eef507ff7ba803f2da4

Authored by Daniela Feitosa
1 parent 321010ae

Fixed some broken tests

app/models/product.rb
... ... @@ -184,7 +184,7 @@ class Product < ActiveRecord::Base
184 184 end
185 185  
186 186 def price_described?
187   - return false if price.nil?
  187 + return false if price.blank? or price == 0
188 188 (price - total_production_cost).zero?
189 189 end
190 190  
... ...
features/browse_catalogs.feature
... ... @@ -73,6 +73,19 @@ Feature: browse catalogs
73 73 And I should not see "qualifiers"
74 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 89 Scenario: product name links to product page
77 90 Given the following products
78 91 | owner | category | name | price |
... ...
features/delete_profile.feature
... ... @@ -16,7 +16,7 @@ Feature: delete profile
16 16 Scenario: deleting profile
17 17 Given I am logged in as "joaosilva"
18 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 20 And I follow "Delete profile"
21 21 Then I should see "Are you sure you want to delete this profile?"
22 22 When I follow "Yes, I am sure"
... ... @@ -32,7 +32,7 @@ Feature: delete profile
32 32 Scenario: giving up of deleting profile
33 33 Given I am logged in as "joaosilva"
34 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 36 And I follow "Delete profile"
37 37 Then I should see "Are you sure you want to delete this profile?"
38 38 When I follow "No, I gave up"
... ... @@ -108,7 +108,7 @@ Feature: delete profile
108 108 Scenario: environment admin deletes profile
109 109 Given I am logged in as admin
110 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 112 And I follow "Delete profile"
113 113 Then I should see "Are you sure you want to delete this profile?"
114 114 When I follow "Yes, I am sure"
... ...
features/edit_article.feature
... ... @@ -91,7 +91,7 @@ Feature: edit article
91 91 Given I am on Joao Silva's sitemap
92 92 When I follow "Save the whales" and wait
93 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 95 Then I should be on /joaosilva/save-the-whales
96 96  
97 97 @selenium
... ...
features/edit_profile.feature
... ... @@ -11,7 +11,7 @@ Feature: edit profile
11 11 | display_name |
12 12 | birth_date |
13 13 When I go to joao's control panel
14   - And I follow "Profile Info and settings"
  14 + And I follow "Edit Profile"
15 15 And I select "November"
16 16 And I select "15"
17 17 And I press "Save"
... ... @@ -23,7 +23,7 @@ Feature: edit profile
23 23 | display_name |
24 24 | birth_date |
25 25 When I go to joao's control panel
26   - And I follow "Profile Info and settings"
  26 + And I follow "Edit Profile"
27 27 And I select "November"
28 28 And I select "15"
29 29 And I press "Save"
... ... @@ -35,7 +35,7 @@ Feature: edit profile
35 35 | display_name |
36 36 | birth_date |
37 37 When I go to joao's control panel
38   - And I follow "Profile Info and settings"
  38 + And I follow "Edit Profile"
39 39 And I select "November"
40 40 And I select "15"
41 41 And I select "1980"
... ... @@ -48,7 +48,7 @@ Feature: edit profile
48 48 | display_name |
49 49 | birth_date |
50 50 When I go to joao's control panel
51   - And I follow "Profile Info and settings"
  51 + And I follow "Edit Profile"
52 52 And I select "November"
53 53 And I select "15"
54 54 And I select "1980"
... ...
features/manage_product_price_details.feature
... ... @@ -80,7 +80,7 @@ Feature: manage product price details
80 80 And I should not see "Taxes" within "#display-price-details"
81 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 84 Given the following product
85 85 | owner | category | name |
86 86 | redemoinho | rock | Yellow Submarine |
... ... @@ -89,13 +89,12 @@ Feature: manage product price details
89 89 | mariasouza | Maria Souza |
90 90 And I am logged in as "mariasouza"
91 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 95 Given I am not logged in
97 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 99 @selenium
101 100 Scenario: display price details if price is fully described
... ...
features/signup.feature
... ... @@ -53,7 +53,7 @@ Feature: signup
53 53 | joaosilva | Joao Silva |
54 54 Given I am logged in as "joaosilva"
55 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 57 And I fill in "Name" with ""
58 58 When I press "Save"
59 59 Then I should see "Name can't be blank"
... ...