Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Forked from zdennis/an example
Created September 30, 2008 14:01
Show Gist options
  • Save dchelimsky/13821 to your computer and use it in GitHub Desktop.
Save dchelimsky/13821 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
def define_macros
Spec::Example::ExampleGroupMethods.extend Module.new { yield }
end
define_macros do
def should_have_per_page(count)
klass = self.described_type
describe "#{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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment