Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conformTo matcher #53

Merged
merged 2 commits into from Oct 11, 2013
Merged

Add conformTo matcher #53

merged 2 commits into from Oct 11, 2013

Conversation

robb
Copy link
Member

@robb robb commented Oct 9, 2013

This adds a matcher to test whether a Class or object conforms to a given protocol.

e.g.:

expect(self.datasource).to.conformTo(@protocol(UITableViewDataSource));

@@ -25,6 +25,12 @@
4913B4D61411E45800040ECB /* EXPMatchers+beGreaterThanOrEqualTo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4913B4D31411E45800040ECB /* EXPMatchers+beGreaterThanOrEqualTo.h */; settings = {ATTRIBUTES = (Public, ); }; };
4913B4D71411E45800040ECB /* EXPMatchers+beGreaterThanOrEqualTo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4913B4D41411E45800040ECB /* EXPMatchers+beGreaterThanOrEqualTo.m */; };
4913B4D81411E45800040ECB /* EXPMatchers+beGreaterThanOrEqualTo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4913B4D41411E45800040ECB /* EXPMatchers+beGreaterThanOrEqualTo.m */; };
541B02AC1805DFD9000DA87C /* EXPMatchers+conformTo.h in Headers */ = {isa = PBXBuildFile; fileRef = 541B02AA1805DFD9000DA87C /* EXPMatchers+conformTo.h */; };
541B02AD1805DFD9000DA87C /* EXPMatchers+conformTo.h in Headers */ = {isa = PBXBuildFile; fileRef = 541B02AA1805DFD9000DA87C /* EXPMatchers+conformTo.h */; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make these headers Public?

@ghost ghost assigned jspahrsummers Oct 10, 2013
#import "NSValue+Expecta.h"
#import <objc/runtime.h>

EXPMatcherImplementationBegin(conformTo, (Protocol *expected)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to add a nil check as a prerequisite.

@jspahrsummers
Copy link
Contributor

🎆

@robb
Copy link
Member Author

robb commented Oct 11, 2013

🎈

@jspahrsummers
Copy link
Contributor

💎

jspahrsummers added a commit that referenced this pull request Oct 11, 2013
Add conformTo matcher
@jspahrsummers jspahrsummers merged commit af2fa79 into specta:master Oct 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants