From 2cfd2befd1948afc4d9148d2251cd2858468966b Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Fri, 11 Jul 2008 17:24:20 +0000 Subject: [PATCH] ActionItem514: test to reproduce error in counting results for product category --- test/unit/environment_finder_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+), 0 deletions(-) diff --git a/test/unit/environment_finder_test.rb b/test/unit/environment_finder_test.rb index b5b34a1..403c65b 100644 --- a/test/unit/environment_finder_test.rb +++ b/test/unit/environment_finder_test.rb @@ -195,6 +195,18 @@ class EnvironmentFinderTest < ActiveSupport::TestCase assert_not_includes prods, prod4 end + should 'count products wihin product category without query' do + finder = EnvironmentFinder.new(Environment.default) + cat = ProductCategory.create!(:name => 'test category', :environment => Environment.default) + ent = Enterprise.create!(:name => 'test enterprise', :identifier => 'test_ent') + prod1 = ent.products.create!(:name => 'test product 1', :product_category => cat) + prod3 = ent.products.create!(:name => 'test product 2') + + prods_count = finder.count(:products, nil, :product_category => cat) + + assert_equal 1, prods_count + end + should 'find in order of creation' do finder = EnvironmentFinder.new(Environment.default) ent1 = Enterprise.create!(:name => 'test enterprise 1', :identifier => 'test_ent1') -- libgit2 0.21.2