Skip to content

Commit

Permalink
wrote a failing spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Marin Usalj committed Jan 24, 2013
1 parent 11dd4e3 commit 63fe50e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Kiwi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
511901A616A95CDE006E7359 /* KWChangeMatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 511901A316A95CDE006E7359 /* KWChangeMatcher.h */; };
511901A716A95CDE006E7359 /* KWChangeMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 511901A416A95CDE006E7359 /* KWChangeMatcher.m */; };
511901A816A95CDE006E7359 /* KWChangeMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 511901A416A95CDE006E7359 /* KWChangeMatcher.m */; };
89F9CB7C16B1C2C400E87D34 /* KWFunctionalTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 89F9CB7B16B1C2C400E87D34 /* KWFunctionalTests.m */; };
9F982A3816A801800030A0B1 /* Carrier.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F982A1E16A801800030A0B1 /* Carrier.m */; };
9F982A3916A801800030A0B1 /* Cruiser.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F982A2016A801800030A0B1 /* Cruiser.m */; };
9F982A3A16A801800030A0B1 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F982A2216A801800030A0B1 /* Engine.m */; };
Expand Down Expand Up @@ -434,6 +435,7 @@
6B39D95F155C9FCB003C3444 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
6B39D960155C9FCB003C3444 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
832C83C7157263B300F160D5 /* libKiwi-OSX.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libKiwi-OSX.a"; sourceTree = BUILT_PRODUCTS_DIR; };
89F9CB7B16B1C2C400E87D34 /* KWFunctionalTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWFunctionalTests.m; sourceTree = "<group>"; };
9F982A1616A7FCD00030A0B1 /* Kiwi.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = Kiwi.podspec; sourceTree = "<group>"; };
9F982A1D16A801800030A0B1 /* Carrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Carrier.h; path = "Test Classes/Carrier.h"; sourceTree = "<group>"; };
9F982A1E16A801800030A0B1 /* Carrier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Carrier.m; path = "Test Classes/Carrier.m"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -805,6 +807,14 @@
name = "Other Frameworks";
sourceTree = "<group>";
};
89F9CB7816B1BE0E00E87D34 /* Functional */ = {
isa = PBXGroup;
children = (
89F9CB7B16B1C2C400E87D34 /* KWFunctionalTests.m */,
);
name = Functional;
sourceTree = "<group>";
};
9F982A1716A7FCF20030A0B1 /* Xcode Templates */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1011,6 +1021,7 @@
F5015BE211583C27002E9A98 /* Tests */ = {
isa = PBXGroup;
children = (
89F9CB7816B1BE0E00E87D34 /* Functional */,
080E96DDFE201D6D7F000001 /* Test Classes */,
F5A1E60711743223002223E1 /* Specs */,
F5BDB84711C0C8CE00DD3474 /* Example Groups */,
Expand Down Expand Up @@ -1668,6 +1679,7 @@
9F982A4116A801800030A0B1 /* TestReporter.m in Sources */,
9F982A4216A801800030A0B1 /* TestSpy.m in Sources */,
9F982A4316A801800030A0B1 /* TestVerifier.m in Sources */,
89F9CB7C16B1C2C400E87D34 /* KWFunctionalTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
56 changes: 56 additions & 0 deletions Tests/KWFunctionalTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// KWFunctionalTests.m
// Kiwi
//
// Created by Marin Usalj on 1/24/13.
// Copyright (c) 2013 Allen Ding. All rights reserved.
//

#import "Kiwi.h"
#import "KiwiTestConfiguration.h"
#import "TestClasses.h"

#if KW_TESTS_ENABLED

@interface KWFunctionalTests : SenTestCase
@end

@implementation KWFunctionalTests

- (void)testInnerContextsAreExecuted {
NSMutableArray *calls = @[@"OuterTestCase",
@"BeforeAll", @"AfterAll", @"BeforeEach", @"AfterEach", @"TestCase",
@"InnerBeforeAll", @"InnerAfterAll", @"InnerBeforeEach", @"InnerAfterEach", @"InnerTestCase",
@"DoubleInnerBeforeAll", @"DoubleInnerAfterAll", @"DoubleInnerBeforeEach", @"DoubleInnerAfterEach", @"DoubleInnerTestCase"
].mutableCopy;

describe(@"OuterDescribe", ^{
it(@"OuterTestCase", ^{ [calls removeObject:@"OuterTestCase"]; });
context(@"OuterContext", ^{
beforeAll(^{ [calls removeObject:@"BeforeAll"]; });
afterAll(^{ [calls removeObject:@"AfterAll"]; });
beforeEach(^{ [calls removeObject:@"BeforeEach"]; });
afterEach(^{ [calls removeObject:@"AfterEach"]; });
it(@"TestCase", ^{ [calls removeObject:@"TestCase"]; });
context(@"Context", ^{
beforeAll(^{ [calls removeObject:@"InnerBeforeAll"]; });
afterAll(^{ [calls removeObject:@"InnerAfterAll"]; });
beforeEach(^{ [calls removeObject:@"InnerBeforeEach"]; });
afterEach(^{ [calls removeObject:@"InnerAfterEach"]; });
it(@"InnerTestCase", ^{ [calls removeObject:@"InnerTestCase"]; });
context(@"InnerContext", ^{
beforeAll(^{ [calls removeObject:@"DoubleInnerBeforeAll"]; });
afterAll(^{ [calls removeObject:@"DoubleInnerAfterAll"]; });
beforeEach(^{ [calls removeObject:@"DoubleInnerBeforeEach"]; });
afterEach(^{ [calls removeObject:@"DoubleInnerAfterEach"]; });
it(@"DoubleInnerTestCase", ^{ [calls removeObject:@"DoubleInnerTestCase"]; });
});
});
});
});
STAssertEquals(0, calls.count, @"Not all the blocks were called! Leftovers: %@", calls);
}

@end

#endif // #if KW_TESTS_ENABLED

0 comments on commit 63fe50e

Please sign in to comment.