From 17a3ec3eab9fd6f35ae396880a31eeb9140b31b8 Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 16:58:36 -0400 Subject: [PATCH 1/9] Added test target and some basic tests --- .gitignore | 1 + .../project.pbxproj | 215 ++++++++++++++++++ .../MMDrawerControllerKitchenSink.xcscheme | 24 ++ .../contents.xcworkspacedata | 10 + .../MMDrawerControllerTests/Info.plist | 24 ++ .../MMDrawerBarButtonItemTests.m | 39 ++++ .../MMDrawerControllerTests.m | 111 +++++++++ KitchenSink/Podfile | 17 ++ KitchenSink/Podfile.lock | 24 ++ 9 files changed, 465 insertions(+) create mode 100644 KitchenSink/MMDrawerControllerKitchenSink.xcworkspace/contents.xcworkspacedata create mode 100644 KitchenSink/MMDrawerControllerTests/Info.plist create mode 100644 KitchenSink/MMDrawerControllerTests/MMDrawerBarButtonItemTests.m create mode 100644 KitchenSink/MMDrawerControllerTests/MMDrawerControllerTests.m create mode 100644 KitchenSink/Podfile create mode 100644 KitchenSink/Podfile.lock diff --git a/.gitignore b/.gitignore index 31e6fd9a..395f1b32 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ profile DerivedData .idea/ *.hmap +KitchenSink/Pods diff --git a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj index 3f848a84..f76fbaaf 100644 --- a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj +++ b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj @@ -35,9 +35,23 @@ 29EEA51B17998320006D68B7 /* MMNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29EEA51A17998320006D68B7 /* MMNavigationController.m */; }; 29EEA51E1799923E006D68B7 /* MMExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29EEA51D1799923E006D68B7 /* MMExampleViewController.m */; }; 29F6163B172AC22A00B31282 /* MMDrawerBarButtonItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F6163A172AC22A00B31282 /* MMDrawerBarButtonItem.m */; }; + 3047B5F8A29F2B9CFBDE6C0A /* libPods-MMDrawerControllerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C9B68C569C42EEEA8091B678 /* libPods-MMDrawerControllerTests.a */; }; + 9B3BE8821AE2B24F0035ED3A /* MMDrawerControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3BE8811AE2B24F0035ED3A /* MMDrawerControllerTests.m */; }; + 9B3BE8891AE2E6590035ED3A /* MMDrawerBarButtonItemTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3BE8881AE2E6590035ED3A /* MMDrawerBarButtonItemTests.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 9B3BE8831AE2B24F0035ED3A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 294A1D0517199537005BF6B1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 294A1D0C17199537005BF6B1; + remoteInfo = MMDrawerControllerKitchenSink; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ + 191D7FC6DFB01967B646039D /* Pods-MMDrawerControllerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MMDrawerControllerTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MMDrawerControllerTests/Pods-MMDrawerControllerTests.debug.xcconfig"; sourceTree = ""; }; 294A1D0D17199537005BF6B1 /* MMDrawerControllerKitchenSink.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MMDrawerControllerKitchenSink.app; sourceTree = BUILT_PRODUCTS_DIR; }; 294A1D1017199537005BF6B1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 294A1D1217199537005BF6B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -87,6 +101,12 @@ 29F61639172AC22A00B31282 /* MMDrawerBarButtonItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMDrawerBarButtonItem.h; sourceTree = ""; }; 29F6163A172AC22A00B31282 /* MMDrawerBarButtonItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMDrawerBarButtonItem.m; sourceTree = ""; }; 462C592D1757C16B006C1D6F /* MMDrawerController+Subclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MMDrawerController+Subclass.h"; sourceTree = ""; }; + 9B3BE87D1AE2B24E0035ED3A /* MMDrawerControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MMDrawerControllerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 9B3BE8801AE2B24F0035ED3A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9B3BE8811AE2B24F0035ED3A /* MMDrawerControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMDrawerControllerTests.m; sourceTree = ""; }; + 9B3BE8881AE2E6590035ED3A /* MMDrawerBarButtonItemTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMDrawerBarButtonItemTests.m; sourceTree = ""; }; + B096110C1946C92CF283EDDD /* Pods-MMDrawerControllerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MMDrawerControllerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MMDrawerControllerTests/Pods-MMDrawerControllerTests.release.xcconfig"; sourceTree = ""; }; + C9B68C569C42EEEA8091B678 /* libPods-MMDrawerControllerTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MMDrawerControllerTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -101,6 +121,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 9B3BE87A1AE2B24E0035ED3A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3047B5F8A29F2B9CFBDE6C0A /* libPods-MMDrawerControllerTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -109,8 +137,10 @@ children = ( 294A1D2D17199819005BF6B1 /* MMDrawerController */, 294A1D1617199537005BF6B1 /* ExampleFiles */, + 9B3BE87E1AE2B24F0035ED3A /* MMDrawerControllerTests */, 294A1D0F17199537005BF6B1 /* Frameworks */, 294A1D0E17199537005BF6B1 /* Products */, + 65DE2DEB9258D5A6F38A4CF6 /* Pods */, ); sourceTree = ""; }; @@ -118,6 +148,7 @@ isa = PBXGroup; children = ( 294A1D0D17199537005BF6B1 /* MMDrawerControllerKitchenSink.app */, + 9B3BE87D1AE2B24E0035ED3A /* MMDrawerControllerTests.xctest */, ); name = Products; sourceTree = ""; @@ -129,6 +160,7 @@ 294A1D1017199537005BF6B1 /* UIKit.framework */, 294A1D1217199537005BF6B1 /* Foundation.framework */, 294A1D1417199537005BF6B1 /* CoreGraphics.framework */, + C9B68C569C42EEEA8091B678 /* libPods-MMDrawerControllerTests.a */, ); name = Frameworks; sourceTree = ""; @@ -240,6 +272,33 @@ path = Icons; sourceTree = SOURCE_ROOT; }; + 65DE2DEB9258D5A6F38A4CF6 /* Pods */ = { + isa = PBXGroup; + children = ( + 191D7FC6DFB01967B646039D /* Pods-MMDrawerControllerTests.debug.xcconfig */, + B096110C1946C92CF283EDDD /* Pods-MMDrawerControllerTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 9B3BE87E1AE2B24F0035ED3A /* MMDrawerControllerTests */ = { + isa = PBXGroup; + children = ( + 9B3BE8881AE2E6590035ED3A /* MMDrawerBarButtonItemTests.m */, + 9B3BE8811AE2B24F0035ED3A /* MMDrawerControllerTests.m */, + 9B3BE87F1AE2B24F0035ED3A /* Supporting Files */, + ); + path = MMDrawerControllerTests; + sourceTree = ""; + }; + 9B3BE87F1AE2B24F0035ED3A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 9B3BE8801AE2B24F0035ED3A /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -260,6 +319,26 @@ productReference = 294A1D0D17199537005BF6B1 /* MMDrawerControllerKitchenSink.app */; productType = "com.apple.product-type.application"; }; + 9B3BE87C1AE2B24E0035ED3A /* MMDrawerControllerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9B3BE8871AE2B24F0035ED3A /* Build configuration list for PBXNativeTarget "MMDrawerControllerTests" */; + buildPhases = ( + 268AB37D2E23AF69931FF2AF /* Check Pods Manifest.lock */, + 9B3BE8791AE2B24E0035ED3A /* Sources */, + 9B3BE87A1AE2B24E0035ED3A /* Frameworks */, + 9B3BE87B1AE2B24E0035ED3A /* Resources */, + 2080B29A53B5BD20ADAA5D78 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 9B3BE8841AE2B24F0035ED3A /* PBXTargetDependency */, + ); + name = MMDrawerControllerTests; + productName = MMDrawerControllerTests; + productReference = 9B3BE87D1AE2B24E0035ED3A /* MMDrawerControllerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -269,6 +348,12 @@ CLASSPREFIX = MM; LastUpgradeCheck = 0460; ORGANIZATIONNAME = "Mutual Mobile"; + TargetAttributes = { + 9B3BE87C1AE2B24E0035ED3A = { + CreatedOnToolsVersion = 6.1.1; + TestTargetID = 294A1D0C17199537005BF6B1; + }; + }; }; buildConfigurationList = 294A1D0817199537005BF6B1 /* Build configuration list for PBXProject "MMDrawerControllerKitchenSink" */; compatibilityVersion = "Xcode 3.2"; @@ -283,6 +368,7 @@ projectRoot = ""; targets = ( 294A1D0C17199537005BF6B1 /* MMDrawerControllerKitchenSink */, + 9B3BE87C1AE2B24E0035ED3A /* MMDrawerControllerTests */, ); }; /* End PBXProject section */ @@ -301,8 +387,48 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 9B3BE87B1AE2B24E0035ED3A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 2080B29A53B5BD20ADAA5D78 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MMDrawerControllerTests/Pods-MMDrawerControllerTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 268AB37D2E23AF69931FF2AF /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 294A1D0917199537005BF6B1 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -329,8 +455,25 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 9B3BE8791AE2B24E0035ED3A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9B3BE8821AE2B24F0035ED3A /* MMDrawerControllerTests.m in Sources */, + 9B3BE8891AE2E6590035ED3A /* MMDrawerBarButtonItemTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 9B3BE8841AE2B24F0035ED3A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 294A1D0C17199537005BF6B1 /* MMDrawerControllerKitchenSink */; + targetProxy = 9B3BE8831AE2B24F0035ED3A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 294A1D1917199537005BF6B1 /* InfoPlist.strings */ = { isa = PBXVariantGroup; @@ -427,6 +570,69 @@ }; name = Release; }; + 9B3BE8851AE2B24F0035ED3A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 191D7FC6DFB01967B646039D /* Pods-MMDrawerControllerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + INFOPLIST_FILE = MMDrawerControllerTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MMDrawerControllerKitchenSink.app/MMDrawerControllerKitchenSink"; + }; + name = Debug; + }; + 9B3BE8861AE2B24F0035ED3A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B096110C1946C92CF283EDDD /* Pods-MMDrawerControllerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + INFOPLIST_FILE = MMDrawerControllerTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MMDrawerControllerKitchenSink.app/MMDrawerControllerKitchenSink"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -448,6 +654,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 9B3BE8871AE2B24F0035ED3A /* Build configuration list for PBXNativeTarget "MMDrawerControllerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9B3BE8851AE2B24F0035ED3A /* Debug */, + 9B3BE8861AE2B24F0035ED3A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 294A1D0517199537005BF6B1 /* Project object */; diff --git a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/xcshareddata/xcschemes/MMDrawerControllerKitchenSink.xcscheme b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/xcshareddata/xcschemes/MMDrawerControllerKitchenSink.xcscheme index b1f250c0..de9019b5 100644 --- a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/xcshareddata/xcschemes/MMDrawerControllerKitchenSink.xcscheme +++ b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/xcshareddata/xcschemes/MMDrawerControllerKitchenSink.xcscheme @@ -20,6 +20,20 @@ ReferencedContainer = "container:MMDrawerControllerKitchenSink.xcodeproj"> + + + + + + + + + + + + + + diff --git a/KitchenSink/MMDrawerControllerTests/Info.plist b/KitchenSink/MMDrawerControllerTests/Info.plist new file mode 100644 index 00000000..36d089e6 --- /dev/null +++ b/KitchenSink/MMDrawerControllerTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.mutualmobile.mmsdcvc.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/KitchenSink/MMDrawerControllerTests/MMDrawerBarButtonItemTests.m b/KitchenSink/MMDrawerControllerTests/MMDrawerBarButtonItemTests.m new file mode 100644 index 00000000..a2e4443b --- /dev/null +++ b/KitchenSink/MMDrawerControllerTests/MMDrawerBarButtonItemTests.m @@ -0,0 +1,39 @@ +// +// MMDrawerBarButtonItemTests.m +// MMDrawerControllerKitchenSink +// +// Created by Eytan Biala on 4/18/15. +// Copyright (c) 2015 Mutual Mobile. All rights reserved. +// + +#import +#import +#import +#import + +#import "MMDrawerBarButtonItem.h" + +@interface MMDrawerBarButtonItemTests : XCTestCase + +@end + +@implementation MMDrawerBarButtonItemTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testButtonTargetAndAction { + id targetMock = OCMClassMock([NSObject class]); + MMDrawerBarButtonItem *button = [[MMDrawerBarButtonItem alloc] initWithTarget:targetMock action:@selector(testButtonTargetAndAction)]; + expect(button.target).to.beTruthy(); + expect(button.action).to.beTruthy(); +} + +@end diff --git a/KitchenSink/MMDrawerControllerTests/MMDrawerControllerTests.m b/KitchenSink/MMDrawerControllerTests/MMDrawerControllerTests.m new file mode 100644 index 00000000..1fe485e5 --- /dev/null +++ b/KitchenSink/MMDrawerControllerTests/MMDrawerControllerTests.m @@ -0,0 +1,111 @@ +// +// MMDrawerControllerTests.m +// MMDrawerControllerTests +// +// Created by Eytan Biala on 4/18/15. +// Copyright (c) 2015 Mutual Mobile. All rights reserved. +// + +#import +#import +#import +#import "MMDrawerController.h" +#import + +SpecBegin(MMDrawerControllerTests) + +describe(@"drawer controller", ^{ + + __block MMDrawerController *drawerController; + + beforeAll(^{ + UIViewController *center = [[UIViewController alloc] init]; + center.view.backgroundColor = [UIColor greenColor]; + + UIViewController *left = [[UIViewController alloc] init]; + left.view.backgroundColor = [UIColor blueColor]; + + UIViewController *right = [[UIViewController alloc] init]; + right.view.backgroundColor = [UIColor magentaColor]; + + drawerController = [[MMDrawerController alloc] initWithCenterViewController:center + leftDrawerViewController:left + rightDrawerViewController:right]; + + [[UIApplication sharedApplication] keyWindow].rootViewController = drawerController; + }); + + beforeEach(^{ + waitUntil(^(DoneCallback done) { + [drawerController closeDrawerAnimated:YES completion:^(BOOL finished) { + done(); + }]; + }); + }); + + it(@"should open the left side", ^{ + + waitUntil(^(DoneCallback done){ + [drawerController openDrawerSide:MMDrawerSideLeft animated:YES completion:^(BOOL finished) { + expect(drawerController.openSide).to.equal(MMDrawerSideLeft); + done(); + }]; + }); + }); + + it(@"should open the right side", ^{ + + waitUntil(^(DoneCallback done){ + [drawerController openDrawerSide:MMDrawerSideRight animated:YES completion:^(BOOL finished) { + expect(drawerController.openSide).to.equal(MMDrawerSideRight); + done(); + }]; + }); + }); + + it(@"should open the right side and then toggle it closed", ^{ + + waitUntil(^(DoneCallback done){ + [drawerController openDrawerSide:MMDrawerSideRight animated:YES completion:^(BOOL finished){ + [drawerController toggleDrawerSide:drawerController.openSide animated:YES completion:^(BOOL finished){ + expect(drawerController.openSide).to.equal(MMDrawerSideNone); + done(); + }]; + }]; + }); + }); + + it(@"should open the left side and then toggle it closed", ^{ + + waitUntil(^(DoneCallback done){ + [drawerController openDrawerSide:MMDrawerSideLeft animated:YES completion:^(BOOL finished){ + [drawerController toggleDrawerSide:drawerController.openSide animated:YES completion:^(BOOL finished){ + expect(drawerController.openSide).to.equal(MMDrawerSideNone); + done(); + }]; + }]; + }); + }); + + it(@"should bounce open the left side", ^{ + + waitUntil(^(DoneCallback done){ + [drawerController bouncePreviewForDrawerSide:MMDrawerSideLeft completion:^(BOOL finished){ + expect(drawerController.openSide).to.equal(MMDrawerSideNone); + done(); + }]; + }); + }); + + it(@"should bounce open the right side", ^{ + + waitUntil(^(DoneCallback done){ + [drawerController bouncePreviewForDrawerSide:MMDrawerSideRight completion:^(BOOL finished){ + expect(drawerController.openSide).to.equal(MMDrawerSideNone); + done(); + }]; + }); + }); +}); + +SpecEnd diff --git a/KitchenSink/Podfile b/KitchenSink/Podfile new file mode 100644 index 00000000..68d08632 --- /dev/null +++ b/KitchenSink/Podfile @@ -0,0 +1,17 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '6.0' + +target 'MMDrawerControllerKitchenSink' do + +end + +target 'MMDrawerControllerTests' do + + pod 'FBSnapshotTestCase' + pod 'Expecta+Snapshots' + pod 'Specta' + pod 'Expecta' + pod 'OCMock' + +end + diff --git a/KitchenSink/Podfile.lock b/KitchenSink/Podfile.lock new file mode 100644 index 00000000..75181497 --- /dev/null +++ b/KitchenSink/Podfile.lock @@ -0,0 +1,24 @@ +PODS: + - Expecta (0.4.0) + - Expecta+Snapshots (1.3.2): + - Expecta (~> 0.3) + - FBSnapshotTestCase (= 1.6) + - FBSnapshotTestCase (1.6) + - OCMock (3.1.2) + - Specta (0.5.0) + +DEPENDENCIES: + - Expecta + - Expecta+Snapshots + - FBSnapshotTestCase + - OCMock + - Specta + +SPEC CHECKSUMS: + Expecta: 392a6b5bfb9f4097e47dd8064d9b732079490332 + Expecta+Snapshots: 40c5ec43b43da3bae957f14fed5dc9177d08ec8b + FBSnapshotTestCase: 9d5fe43b29ae3a0ed8fc829477971b281038f748 + OCMock: a10ea9f0a6e921651f96f78b6faee95ebc813b92 + Specta: eb90708ed77569bbda089f8ead10bb99b8e9489e + +COCOAPODS: 0.36.4 From 1399ff8e5bc70f97aa87f3932bbbb7f8a5241844 Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 17:12:47 -0400 Subject: [PATCH 2/9] Added Slather for sending code coverage to coveralls --- .gitignore | 2 ++ .slather.yml | 4 ++++ .travis.yml | 11 ++++++++++- .../project.pbxproj | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .slather.yml diff --git a/.gitignore b/.gitignore index 395f1b32..09016b54 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ DerivedData .idea/ *.hmap KitchenSink/Pods + +KitchenSink/MMDrawerControllerKitchenSink.xcworkspace/xcshareddata/MMDrawerControllerKitchenSink.xccheckout diff --git a/.slather.yml b/.slather.yml new file mode 100644 index 00000000..7cce654f --- /dev/null +++ b/.slather.yml @@ -0,0 +1,4 @@ +ci_service: travis_ci +coverage_service: coveralls +xcodeproj: KitchenSink/MMDrawerControllerKitchenSink.xcodeproj +source_directory: MMDrawerController diff --git a/.travis.yml b/.travis.yml index ec14b54b..c0ce7bfe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,11 @@ language: objective-c -script: xcodebuild -project KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/ -scheme MMDrawerControllerKitchenSink -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO \ No newline at end of file +xcode_sdk: iphonesimulator +xcode_scheme: MMDrawerControllerKitchenSink +xcode_workspace: MMDrawerControllerKitchenSink.xcworkspace +before_install: + - brew update + - brew install xctool + - gem update cocoapods + - gem install slather +after_success: + - slather diff --git a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj index f76fbaaf..77883fdf 100644 --- a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj +++ b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj @@ -502,6 +502,8 @@ COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_TEST_COVERAGE_FILES = YES; + GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -533,6 +535,8 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_GENERATE_TEST_COVERAGE_FILES = YES; + GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; From 33ac73e2098c115a1595dc6950b9fc86dc73f39e Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 17:15:30 -0400 Subject: [PATCH 3/9] Added coveralls badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b1385475..df037efc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ #Mutual Mobile Drawer Controller +[![Coverage Status](https://coveralls.io/repos/eytanbiala/MMDrawerController/badge.svg)](https://coveralls.io/r/eytanbiala/MMDrawerController) + `MMDrawerController` is a side drawer navigation container view controller designed to support the growing number of applications that leverage the side drawer paradigm. This library is designed to exclusively support side drawer navigation in a light-weight, focused approach while exposing the ability to provide custom animations for presenting and dismissing the drawer.

From a8e400fe7326b5760d271d7ec38e1eeba912e240 Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 17:29:19 -0400 Subject: [PATCH 4/9] Updated travis config Conflicts: README.md --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c0ce7bfe..c946b8c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ xcode_scheme: MMDrawerControllerKitchenSink xcode_workspace: MMDrawerControllerKitchenSink.xcworkspace before_install: - brew update - - brew install xctool + - brew reinstall xctool - gem update cocoapods - gem install slather after_success: From c9144a98b2b0d6ad4720990e91c707b09413aa8f Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 17:38:25 -0400 Subject: [PATCH 5/9] Updated travis --- .travis.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index c946b8c2..f6624a3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,7 @@ language: objective-c -xcode_sdk: iphonesimulator -xcode_scheme: MMDrawerControllerKitchenSink -xcode_workspace: MMDrawerControllerKitchenSink.xcworkspace +script: xcodebuild -workspace KitchenSink/MMDrawerControllerKitchenSink.xcworkspace -scheme MMDrawerControllerKitchenSink -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO before_install: - - brew update - - brew reinstall xctool - - gem update cocoapods - - gem install slather + - export LANG=en_US.UTF-8 + - gem install cocoapods xcpretty slather --no-ri --no-rdoc --no-ri --no-rdoc after_success: - slather From acbff8aa2ac4e9c875d4e430a2adab8f6d552bcb Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 17:42:31 -0400 Subject: [PATCH 6/9] Updated Travis --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f6624a3a..1ff28ab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,11 @@ language: objective-c -script: xcodebuild -workspace KitchenSink/MMDrawerControllerKitchenSink.xcworkspace -scheme MMDrawerControllerKitchenSink -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO +xcode_sdk: iphonesimulator +xcode_scheme: MMDrawerControllerKitchenSink +xcode_workspace: KitchenSink/MMDrawerControllerKitchenSink.xcworkspace before_install: - - export LANG=en_US.UTF-8 - - gem install cocoapods xcpretty slather --no-ri --no-rdoc --no-ri --no-rdoc + - brew update + - brew reinstall xctool + - gem update cocoapods + - gem install slather after_success: - slather From 61892aab301f9a04c26aee8d7f696a3b9d701937 Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 18:00:26 -0400 Subject: [PATCH 7/9] Updated Travis again --- .travis.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ff28ab6..afc24dbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ language: objective-c -xcode_sdk: iphonesimulator -xcode_scheme: MMDrawerControllerKitchenSink -xcode_workspace: KitchenSink/MMDrawerControllerKitchenSink.xcworkspace before_install: - - brew update - - brew reinstall xctool - - gem update cocoapods - - gem install slather -after_success: - - slather + - export LANG=en_US.UTF-8 + - gem install cocoapods xcpretty slather --no-ri --no-rdoc + - pod install --project-directory=KitchenSink + +script: + - set -o pipefail && xcodebuild test -workspace KitchenSink/MMDrawerControllerKitchenSink.xcworkspace -scheme MMDrawerControllerKitchenSink -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c + +after_success: slather From dd5b7906b72973ba3412d8ff38f9bec944c2a114 Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 18:17:05 -0400 Subject: [PATCH 8/9] Updated badge and travis --- .travis.yml | 3 ++- README.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index afc24dbb..4fd3abbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,5 @@ before_install: script: - set -o pipefail && xcodebuild test -workspace KitchenSink/MMDrawerControllerKitchenSink.xcworkspace -scheme MMDrawerControllerKitchenSink -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c -after_success: slather +after_success: + - slather diff --git a/README.md b/README.md index df037efc..8ef22374 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ #Mutual Mobile Drawer Controller -[![Coverage Status](https://coveralls.io/repos/eytanbiala/MMDrawerController/badge.svg)](https://coveralls.io/r/eytanbiala/MMDrawerController) +[![Coverage Status](https://coveralls.io/repos/mutualmobile/MMDrawerController/badge.svg)](https://coveralls.io/r/mutualmobile/MMDrawerController) `MMDrawerController` is a side drawer navigation container view controller designed to support the growing number of applications that leverage the side drawer paradigm. This library is designed to exclusively support side drawer navigation in a light-weight, focused approach while exposing the ability to provide custom animations for presenting and dismissing the drawer. From 09a6155940c2d4f30d19b493a9b3189475eb63f3 Mon Sep 17 00:00:00 2001 From: Eytan Biala Date: Sat, 18 Apr 2015 18:18:51 -0400 Subject: [PATCH 9/9] Added build status badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8ef22374..a1a9256b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ #Mutual Mobile Drawer Controller +[![Build Status](https://travis-ci.org/mutualmobile/MMDrawerController.svg?branch=master)](https://travis-ci.org/mutualmobile/MMDrawerController) [![Coverage Status](https://coveralls.io/repos/mutualmobile/MMDrawerController/badge.svg)](https://coveralls.io/r/mutualmobile/MMDrawerController) `MMDrawerController` is a side drawer navigation container view controller designed to support the growing number of applications that leverage the side drawer paradigm. This library is designed to exclusively support side drawer navigation in a light-weight, focused approach while exposing the ability to provide custom animations for presenting and dismissing the drawer.