Sha256: 863d7d1db2535b0bdd8eb77fd31f47fe0e18281bef3dfe2cd0338348dffd03c3
Contents?: true
Size: 1003 Bytes
Versions: 1
Compression:
Stored size: 1003 Bytes
Contents
module Woulda module WillPaginate module Macros def self.should_have_per_page(collection_name, options) size = options[:size] || 30 should "paginate #{size} #{collection_name} at a time" do assert collection = assigns(collection_name), "Controller did not assign to @#{collection_name.to_s}." assert_kind_of WillPaginate::Collection, collection, "@#{collection_name.to_s} was not a WillPaginate collection." assert_equal size, collection.per_page, "Expected #{size} items, but got #{collection.per_page}." end end def should_have_per_page(count) klass = self.name.gsub(/Test$/, '').constantize context "#{klass}" do should "respond to per_page" do assert klass.respond_to?(:per_page), "#{klass} does not respond to :per_page" end should "have #{count} per page" do assert_equal count, klass.per_page end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clearlynuts-woulda-0.2.3 | lib/woulda/will_paginate/macros.rb |