-
-
Save gumayunov/13861 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../spec_helper' | |
class Foo | |
def self.per_page | |
10 | |
end | |
end | |
describe Foo do | |
should_have_per_page 10 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def define_macros | |
Spec::Example::ExampleGroupMethods.extend Module.new { yield } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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