From e314d49e9976f3b0e22bb17f7bc4aee6e2d72105 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 29 Jan 2014 16:03:49 -0300 Subject: [PATCH] rails3: fix count on paginated collections --- test/functional/catalog_controller_test.rb | 2 +- test/functional/manage_products_controller_test.rb | 4 ++-- test/functional/profile_controller_test.rb | 4 ++-- test/functional/search_controller_test.rb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index abe46e0..538a220 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -47,7 +47,7 @@ class CatalogControllerTest < ActionController::TestCase assert_equal 12, @enterprise.products.count get :index, :profile => @enterprise.identifier - assert_equal 9, assigns(:products).count + assert_equal 9, assigns(:products).size assert_tag :a, :attributes => {:class => 'next_page'} end diff --git a/test/functional/manage_products_controller_test.rb b/test/functional/manage_products_controller_test.rb index 7a551f3..d740bbd 100644 --- a/test/functional/manage_products_controller_test.rb +++ b/test/functional/manage_products_controller_test.rb @@ -361,7 +361,7 @@ class ManageProductsControllerTest < ActionController::TestCase fast_create(Product, :name => "test product_#{n}", :enterprise_id => @enterprise.id, :product_category_id => @product_category.id) end get :index, :profile => @enterprise.identifier - assert_equal 10, assigns(:products).count + assert_equal 10, assigns(:products).size end should 'paginate the manage products list of enterprise' do @@ -373,7 +373,7 @@ class ManageProductsControllerTest < ActionController::TestCase assert_tag :tag => 'a', :attributes => { :rel => 'next', :href => "/myprofile/#{@enterprise.identifier}/manage_products?page=2" } get :index, :profile => @enterprise.identifier, :page => 2 - assert_equal 2, assigns(:products).count + assert_equal 2, assigns(:products).size end should 'display tabs even if description and inputs are empty and user is allowed' do diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 75598d6..10a5f90 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -905,7 +905,7 @@ class ProfileControllerTest < ActionController::TestCase community = fast_create(Community) 40.times{ fast_create(ActionTrackerNotification, :profile_id => community.id, :action_tracker_id => fast_create(ActionTracker::Record, :user_id => profile.id)) } get :index, :profile => community.identifier - assert_equal 15, assigns(:network_activities).count + assert_equal 15, assigns(:network_activities).size end should 'the self activity not crashes with user not logged in' do @@ -1162,7 +1162,7 @@ class ProfileControllerTest < ActionController::TestCase get :view_more_network_activities, :profile => profile.identifier, :page => 2 assert_response :success assert_template '_profile_network_activities' - assert_equal 10, assigns(:activities).count + assert_equal 10, assigns(:activities).size end should "be logged in to access the view_more_network_activities action" do diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index a4f7609..696b15c 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -520,7 +520,7 @@ class SearchControllerTest < ActionController::TestCase get :people assert_equal SearchController::BLOCKS_SEARCH_LIMIT+3, Person.count - assert_equal SearchController::BLOCKS_SEARCH_LIMIT, assigns(:searches)[:people][:results].count + assert_equal SearchController::BLOCKS_SEARCH_LIMIT, assigns(:searches)[:people][:results].size assert_tag :a, '', :attributes => {:class => 'next_page'} end @@ -540,7 +540,7 @@ class SearchControllerTest < ActionController::TestCase get :communities assert_equal SearchController::BLOCKS_SEARCH_LIMIT+3, Community.count - assert_equal SearchController::BLOCKS_SEARCH_LIMIT, assigns(:searches)[:communities][:results].count + assert_equal SearchController::BLOCKS_SEARCH_LIMIT, assigns(:searches)[:communities][:results].size assert_tag :a, '', :attributes => {:class => 'next_page'} end -- libgit2 0.21.2