Created
March 30, 2011 15:55
-
-
Save hawx/894659 to your computer and use it in GitHub Desktop.
All_of matcher for rspec
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
# Not the best example, but | |
# | |
# it "is an array of Hashes" do | |
# all_of(subject).should be_kind_of Hash | |
# end | |
# | |
class AllOf | |
def initialize(items) | |
@items = items | |
end | |
def should(*args) | |
@items.all? {|i| i.should(*args)} | |
end | |
def should_not(*args) | |
@items.all? {|i| i.should_not(*args)} | |
end | |
end | |
def all_of(items) | |
AllOf.new(items) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment