Skip to content

Instantly share code, notes, and snippets.

@martin-nearsoft
martin-nearsoft / Expecta.m
Last active August 29, 2015 14:01
Objective-C Unit Testing - Matchers
// Matchers
// --------------------
expect(x).to.equal(y); // compares objects or primitives x and y and passes if they are identical (==) or
// equivalent (isEqual:).
expect(x).to.beIdenticalTo(y); // compares objects x and y and passes if they are identical and have the
// same memory address.
expect(x).to.beNil(); // passes if x is nil.
expect(x).to.beTruthy(); // passes if x evaluates to true (non-zero).
expect(x).to.beFalsy(); // passes if x evaluates to false (zero).
expect(x).to.contain(y); // passes if an instance of NSArray or NSString x contains y.
@martin-nearsoft
martin-nearsoft / Podfile
Last active August 29, 2015 14:01
Objective-C Unit Testing - CocoaPods
# http://cocoapods.org/
# $ sudo gem update --system
# $ sudo gem install cocoapods
platform :ios, '7.0'
inhibit_all_warnings!
xcodeproj 'myproject.xcodeproj'
target :myproject do
@martin-nearsoft
martin-nearsoft / ThingSpecs.m
Last active April 14, 2024 04:26
Objective-C Unit Testing - Specs
#define EXP_SHORTHAND
#import <Specta/Specta.h> // A light-weight TDD / BDD framework for Objective-C & Cocoa.
#import <Expecta/Expecta.h> // A Matcher Framework for Objective-C/Cocoa
#import <OCMock/OCMock.h> // An Objective-C implementation of mock objects
#import <OCMock/NSInvocation+OCMAdditions.h>
// 'beforeEach' and 'afterEach' are also aliased as 'before' and 'after' respectively.
// 'describe' is also aliased as 'context'.
// 'it' is also aliased as 'example' and 'specify'.