diff --git a/.gitignore b/.gitignore index 31e6fd9a..09016b54 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ profile 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..4fd3abbe 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 +before_install: + - 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 diff --git a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj index 3f848a84..77883fdf 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; @@ -359,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", @@ -390,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; @@ -427,6 +574,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 +658,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 diff --git a/README.md b/README.md index b1385475..a1a9256b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ #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.