Commit 24bb5d14f27ebfb47519e202dc74653ed9eef27e
1 parent
49fa6cb1
Exists in
master
and in
29 other branches
ActionItem861: removing line price from products if not informed
Showing
3 changed files
with
39 additions
and
5 deletions
Show diff stats
app/views/catalog/index.rhtml
... | ... | @@ -9,7 +9,9 @@ |
9 | 9 | <%= link_to_product product %> |
10 | 10 | </h3> |
11 | 11 | <ul> |
12 | - <li class="product_price"> <%= _('Price: %s') % ( product.price ? "%.2f" % product.price : content_tag('em', _('not informed')) ) %> </li> | |
12 | + <% if product.price %> | |
13 | + <li class="product_price"> <%= _('Price: %s') % ( "%.2f" % product.price) %> </li> | |
14 | + <% end %> | |
13 | 15 | <li class="product_category"> <%= link_to_category(product.product_category) %> </li> |
14 | 16 | </ul> |
15 | 17 | <% if product.description %> |
... | ... | @@ -21,5 +23,5 @@ |
21 | 23 | <% end %> |
22 | 24 | </li> |
23 | 25 | <% end %> |
24 | -<ul> | |
26 | +</ul> | |
25 | 27 | ... | ... |
app/views/catalog/show.rhtml
... | ... | @@ -8,9 +8,11 @@ |
8 | 8 | <%= txt2html @product.description if @product.description %> |
9 | 9 | </div> |
10 | 10 | |
11 | -<p class="product_price"> | |
12 | -<%= _('Price: %s') % ( @product.price ? "<strong>%.2f</strong>" % @product.price : content_tag('em', _('not informed')) ) %> | |
13 | -</p> | |
11 | +<% if @product.price %> | |
12 | + <p class="product_price"> | |
13 | + <%= _('Price: %s') % ( "<strong>%.2f</strong>" % @product.price) %> | |
14 | + </p> | |
15 | +<% end %> | |
14 | 16 | |
15 | 17 | <p class="product_category"> |
16 | 18 | <%= _('Category: %s ') % link_to_category(@product.product_category) %> | ... | ... |
test/functional/catalog_controller_test.rb
... | ... | @@ -75,4 +75,34 @@ class CatalogControllerTest < Test::Unit::TestCase |
75 | 75 | assert_redirected_to :controller => 'profile', :action => 'index', :profile => ent.identifier |
76 | 76 | end |
77 | 77 | |
78 | + should 'not show product price when listing products if not informed' do | |
79 | + ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | |
80 | + prod = ent.products.create!(:name => 'Product test') | |
81 | + get :index, :profile => ent.identifier | |
82 | + assert_no_tag :tag => 'li', :attributes => { :class => 'product_price' }, :content => /Price:/ | |
83 | + end | |
84 | + | |
85 | + should 'show product price when listing products if informed' do | |
86 | + ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | |
87 | + prod = ent.products.create!(:name => 'Product test', :price => 50.00) | |
88 | + get :index, :profile => ent.identifier | |
89 | + assert_tag :tag => 'li', :attributes => { :class => 'product_price' }, :content => /Price:/ | |
90 | + end | |
91 | + | |
92 | + should 'not show product price when showing product if not informed' do | |
93 | + ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | |
94 | + prod = ent.products.create!(:name => 'Product test') | |
95 | + get :show, :id => prod.id, :profile => ent.identifier | |
96 | + | |
97 | + assert_no_tag :tag => 'p', :attributes => { :class => 'product_price' }, :content => /Price:/ | |
98 | + end | |
99 | + | |
100 | + should 'show product price when showing product if informed' do | |
101 | + ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | |
102 | + prod = ent.products.create!(:name => 'Product test', :price => 50.00) | |
103 | + get :show, :id => prod.id, :profile => ent.identifier | |
104 | + | |
105 | + assert_tag :tag => 'p', :attributes => { :class => 'product_price' }, :content => /Price:/ | |
106 | + end | |
107 | + | |
78 | 108 | end | ... | ... |