Created
August 27, 2013 00:22
-
-
Save BenEddy/6348314 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
class MockActiveRelation < Hash | |
def scoped? | |
any? | |
end | |
def name_matching(name) | |
new(name_scope: name) | |
end | |
def scoped_by_name?(name) | |
self[:name_scope] == name | |
end | |
def email_matching(email) | |
new(email_scope: email) | |
end | |
def scoped_by_email?(email) | |
self[:email_scope] == email | |
end | |
def new(invocation) | |
MockActiveRelation[merge(invocation)] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment