Skip to content

Instantly share code, notes, and snippets.

@zdennis
Created September 30, 2008 12:54
Show Gist options
  • Save zdennis/13804 to your computer and use it in GitHub Desktop.
Save zdennis/13804 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/../spec_helper'
class Foo
def self.per_page
10
end
end
describe Foo do
should_have_per_page 10
end
Spec::Runner.configure do |config|
# ... other config stuff
config.include WillPaginateMacros
end
module WillPaginateMacros
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
def should_have_per_page(count)
klass = self.described_type
context "#{klass}" do
it "should respond to per_page" do
klass.should respond_to(:per_page)
end
it "should have #{count} per page" do
klass.per_page.should == count
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment