Commit 2cfd2befd1948afc4d9148d2251cd2858468966b
1 parent
5413c056
Exists in
master
and in
29 other branches
ActionItem514: test to reproduce error in counting results for product category
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2208 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
test/unit/environment_finder_test.rb
@@ -195,6 +195,18 @@ class EnvironmentFinderTest < ActiveSupport::TestCase | @@ -195,6 +195,18 @@ class EnvironmentFinderTest < ActiveSupport::TestCase | ||
195 | assert_not_includes prods, prod4 | 195 | assert_not_includes prods, prod4 |
196 | end | 196 | end |
197 | 197 | ||
198 | + should 'count products wihin product category without query' do | ||
199 | + finder = EnvironmentFinder.new(Environment.default) | ||
200 | + cat = ProductCategory.create!(:name => 'test category', :environment => Environment.default) | ||
201 | + ent = Enterprise.create!(:name => 'test enterprise', :identifier => 'test_ent') | ||
202 | + prod1 = ent.products.create!(:name => 'test product 1', :product_category => cat) | ||
203 | + prod3 = ent.products.create!(:name => 'test product 2') | ||
204 | + | ||
205 | + prods_count = finder.count(:products, nil, :product_category => cat) | ||
206 | + | ||
207 | + assert_equal 1, prods_count | ||
208 | + end | ||
209 | + | ||
198 | should 'find in order of creation' do | 210 | should 'find in order of creation' do |
199 | finder = EnvironmentFinder.new(Environment.default) | 211 | finder = EnvironmentFinder.new(Environment.default) |
200 | ent1 = Enterprise.create!(:name => 'test enterprise 1', :identifier => 'test_ent1') | 212 | ent1 = Enterprise.create!(:name => 'test enterprise 1', :identifier => 'test_ent1') |