Commit 789e8e48aefc1156e56222e5c537f685e09f1183
1 parent
14319a14
Exists in
master
and in
29 other branches
ActionItem266: oops: fixing tests
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1654 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
app/views/manage_products/_subcategories.rhtml
1 | <p><%= _('Current category:') %></p> | 1 | <p><%= _('Current category:') %></p> |
2 | +<%= hidden_field_tag 'product[product_category_id]', @current_category.id %> | ||
2 | <% | 3 | <% |
3 | categories = [@current_category] | 4 | categories = [@current_category] |
4 | categories.push(@current_category) while @current_category and @current_category = @current_category.parent | 5 | categories.push(@current_category) while @current_category and @current_category = @current_category.parent |
test/functional/manage_products_controller_test.rb
@@ -137,5 +137,15 @@ class ManageProductsControllerTest < Test::Unit::TestCase | @@ -137,5 +137,15 @@ class ManageProductsControllerTest < Test::Unit::TestCase | ||
137 | get 'update_subcategories', :profile => @enterprise.identifier, :id => category1.id | 137 | get 'update_subcategories', :profile => @enterprise.identifier, :id => category1.id |
138 | assert_no_tag :tag => 'p', :content => 'Select a subcategory:' | 138 | assert_no_tag :tag => 'p', :content => 'Select a subcategory:' |
139 | end | 139 | end |
140 | + | ||
141 | + should "create new product categorized" do | ||
142 | + environment = Environment.default | ||
143 | + category1 = ProductCategory.create!(:name => 'Category 1', :environment => environment) | ||
144 | + category2 = ProductCategory.create!(:name => 'Category 2', :environment => environment, :parent => category1) | ||
145 | + assert_difference Product, :count do | ||
146 | + post 'new', :profile => @enterprise.identifier, :product => { :name => 'test product', :product_category_id => category2.id } | ||
147 | + assert_equal category2, assigns(:product).product_category | ||
148 | + end | ||
149 | + end | ||
140 | 150 | ||
141 | end | 151 | end |