Skip to content

Commit

Permalink
Find and replace expectation syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jspahrsummers committed Oct 21, 2014
1 parent 16559af commit f5851c6
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 332 deletions.
18 changes: 9 additions & 9 deletions MantleTests/MTLArrayManipulationSpec.m
Expand Up @@ -15,57 +15,57 @@
describe(@"-mtl_firstObject", ^{
it(@"should return the first object", ^{
NSArray *array = @[ @1, @2, @3 ];
expect(array.mtl_firstObject).to.equal(@1);
expect(array.mtl_firstObject).to(equal(@1));
});

it(@"should return nil for an empty array", ^{
NSArray *array = @[];
expect(array.mtl_firstObject).to.beNil();
expect(array.mtl_firstObject).to(beNil());
});
});

describe(@"-mtl_arrayByRemovingObject:", ^{
it(@"should return a new array without the object", ^{
NSArray *array = @[ @1, @2, @3 ];
NSArray *expected = @[ @2, @3 ];
expect([array mtl_arrayByRemovingObject:@1]).to.equal(expected);
expect([array mtl_arrayByRemovingObject:@1]).to(equal(expected));
});

it(@"should return a new array without all occurrences of the object", ^{
NSArray *array = @[ @1, @2, @3, @1, @1 ];
NSArray *expected = @[ @2, @3 ];
expect([array mtl_arrayByRemovingObject:@1]).to.equal(expected);
expect([array mtl_arrayByRemovingObject:@1]).to(equal(expected));
});

it(@"should return an equivalent array if it doesn't contain the object", ^{
NSArray *array = @[ @1, @2, @3 ];
expect([array mtl_arrayByRemovingObject:@42]).to.equal(array);
expect([array mtl_arrayByRemovingObject:@42]).to(equal(array));
});
});

describe(@"-mtl_arrayByRemovingFirstObject", ^{
it(@"should return the array without the first object", ^{
NSArray *array = @[ @1, @2, @3 ];
NSArray *expected = @[ @2, @3 ];
expect(array.mtl_arrayByRemovingFirstObject).to.equal(expected);
expect(array.mtl_arrayByRemovingFirstObject).to(equal(expected));
});

it(@"should return the same array if it's empty", ^{
NSArray *array = @[];
expect(array.mtl_arrayByRemovingFirstObject).to.equal(array);
expect(array.mtl_arrayByRemovingFirstObject).to(equal(array));
});
});

describe(@"-mtl_arrayByRemovingLastObject", ^{
it(@"should return the array without the last object", ^{
NSArray *array = @[ @1, @2, @3 ];
NSArray *expected = @[ @1, @2 ];
expect(array.mtl_arrayByRemovingLastObject).to.equal(expected);
expect(array.mtl_arrayByRemovingLastObject).to(equal(expected));
});

it(@"should return the same array if it's empty", ^{
NSArray *array = @[];
expect(array.mtl_arrayByRemovingLastObject).to.equal(array);
expect(array.mtl_arrayByRemovingLastObject).to(equal(array));
});
});

Expand Down
12 changes: 6 additions & 6 deletions MantleTests/MTLComparisonAdditionsSpec.m
Expand Up @@ -22,31 +22,31 @@
id obj2 = @"Test2";

it(@"returns true when given two values of nil", ^{
expect(MTLEqualObjects(nil, nil)).to.beTruthy();
expect(MTLEqualObjects(nil, nil)).to(beTruthy());
});

it(@"returns true when given two equal objects", ^{
expect(MTLEqualObjects(obj1, obj1)).to.beTruthy();
expect(MTLEqualObjects(obj1, obj1)).to(beTruthy());
});

it(@"returns false when given two inequal objects", ^{
expect(MTLEqualObjects(obj1, obj2)).to.beFalsy();
expect(MTLEqualObjects(obj1, obj2)).to(beFalsy());
});

it(@"returns false when given an object and nil", ^{
expect(MTLEqualObjects(obj1, nil)).to.beFalsy();
expect(MTLEqualObjects(obj1, nil)).to(beFalsy());
});

it(@"returns the same value when given symmetric arguments", ^{
expect(MTLEqualObjects(obj2, obj1)).to.equal(MTLEqualObjects(obj1, obj2));
expect(MTLEqualObjects(obj2, obj1)).to(equal(MTLEqualObjects(obj1, obj2)));
});

describe(@"when comparing mutable objects", ^{
id mutableObj1 = [obj1 mutableCopy];
id mutableObj2 = [obj1 mutableCopy];

it(@"returns true when given two equal but not identical objects", ^{
expect(MTLEqualObjects(mutableObj1, mutableObj2)).to.beTruthy();
expect(MTLEqualObjects(mutableObj1, mutableObj2)).to(beTruthy());
});
});
});
Expand Down
16 changes: 8 additions & 8 deletions MantleTests/MTLDictionaryManipulationSpec.m
Expand Up @@ -17,24 +17,24 @@

it(@"should return the same dictionary when adding from an empty dictionary", ^{
NSDictionary *combined = [dict mtl_dictionaryByAddingEntriesFromDictionary:@{}];
expect(combined).to.equal(dict);
expect(combined).to(equal(dict));
});

it(@"should return the same dictionary when adding from nil", ^{
NSDictionary *combined = [dict mtl_dictionaryByAddingEntriesFromDictionary:nil];
expect(combined).to.equal(dict);
expect(combined).to(equal(dict));
});

it(@"should add any new keys", ^{
NSDictionary *combined = [dict mtl_dictionaryByAddingEntriesFromDictionary:@{ @"buzz": @(10), @"baz": NSNull.null }];
NSDictionary *expected = @{ @"foo": @"bar", @(5): NSNull.null, @"buzz": @(10), @"baz": NSNull.null };
expect(combined).to.equal(expected);
expect(combined).to(equal(expected));
});

it(@"should replace any existing keys", ^{
NSDictionary *combined = [dict mtl_dictionaryByAddingEntriesFromDictionary:@{ @(5): @(10), @"buzz": @"baz" }];
NSDictionary *expected = @{ @"foo": @"bar", @(5): @(10), @"buzz": @"baz" };
expect(combined).to.equal(expected);
expect(combined).to(equal(expected));
});
});

Expand All @@ -43,24 +43,24 @@

it(@"should return the same dictionary when removing keys that don't exist in the receiver", ^{
NSDictionary *removed = [dict mtl_dictionaryByRemovingEntriesWithKeys:[NSSet setWithObject:@"hi"]];
expect(removed).to.equal(dict);
expect(removed).to(equal(dict));
});

it(@"should return the same dictionary when given a nil array of keys", ^{
NSDictionary *removed = [dict mtl_dictionaryByRemovingEntriesWithKeys:nil];
expect(removed).to.equal(dict);
expect(removed).to(equal(dict));
});

it(@"should remove all the entries for the given keys", ^{
NSDictionary *removed = [dict mtl_dictionaryByRemovingEntriesWithKeys:[NSSet setWithObject:@(5)]];
NSDictionary *expected = @{ @"foo": @"bar" };
expect(removed).to.equal(expected);
expect(removed).to(equal(expected));
});

it(@"should return an empty dictionary when it removes all its keys", ^{
NSDictionary *removed = [dict mtl_dictionaryByRemovingEntriesWithKeys:[NSSet setWithArray:dict.allKeys]];
NSDictionary *expected = @{};
expect(removed).to.equal(expected);
expect(removed).to(equal(expected));
});
});

Expand Down
6 changes: 3 additions & 3 deletions MantleTests/MTLErrorModelExceptionSpec.m
Expand Up @@ -20,9 +20,9 @@

NSError *error = [NSError mtl_modelErrorWithException:exception];

expect(error).toNot.beNil();
expect(error.localizedDescription).to.equal(@"Just Testing");
expect(error.localizedFailureReason).to.equal(@"Just Testing");
expect(error).notTo(beNil());
expect(error.localizedDescription).to(equal(@"Just Testing"));
expect(error.localizedFailureReason).to(equal(@"Just Testing"));
});
});

Expand Down

0 comments on commit f5851c6

Please sign in to comment.