vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb
def find_articles(*args)
    (1..@how_many).each { |n| Article.create(:name => n, :author_id => 1) }
    results = Article.find(*args)
    if results.size > results.page_size
      page_count, num_on_last_page = how_many.divmod(results.page_size)
      page_count = page_count + 1 if num_on_last_page > 0
    else 
      page_count = 1
    end
    if (page_count != results.page_count)
      raise "Expected #{page_count} pages but there were #{results.page_count}"
    end  
    yield results if block_given? 
    results
  end
# Create n number of articles, and query them using the specified
# arguments. Check that the correct number of pages were returned
# and yield the results.
#
Create n number of articles, and query them using the specified
arguments. Check that the correct number of pages were returned
and yield the results.
Create n number of articles and query them using the specified arguments . Check that the correct number of pages were returned and yield the results .
def find_articles(*args)
    (1..@how_many).each { |n| Article.create(:name => n, :author_id => 1) }
    results = Article.find(*args)
    if results.size > results.page_size
      page_count, num_on_last_page = how_many.divmod(results.page_size)
      page_count = page_count + 1 if num_on_last_page > 0
    else 
      page_count = 1
    end
    if (page_count != results.page_count)
      raise "Expected #{page_count} pages but there were #{results.page_count}"
    end  
    yield results if block_given? 
    results
  end
def find_articles ( * args ) ( 1 .. @how_many ) . each { | n | Article . create ( :name => n , :author_id => 1 ) } results = Article . find ( * args ) if results . size > results . page_size page_count , num_on_last_page = how_many . divmod ( results . page_size ) page_count = page_count + 1 if num_on_last_page > 0 else page_count = 1 end if ( page_count != results . page_count ) raise "Expected #{page_count} pages but there were #{results.page_count}" end yield results if block_given? results end
Create n number of articles, and query them using the specified
arguments.
Create n number of articles and query them using the specified arguments .
args