Created
March 1, 2013 22:28
-
-
Save cupakromer/5068434 to your computer and use it in GitHub Desktop.
Custom with matcher
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
class SubstringMatcher | |
def initialize(regexp) | |
@regexp = regexp | |
end | |
def ==(actual) | |
actual.to_s =~ @regexp | |
end | |
end | |
def substring(regexp) | |
SubstringMatcher.new regexp | |
end | |
# thing.should_receive(:foo).with(substring "test").and_call_original |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment