Skip to content

Commit

Permalink
Backport tests to iOS 8.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
SlaunchaMan committed Nov 16, 2018
1 parent 56a95af commit 4682341
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 79 deletions.
2 changes: 0 additions & 2 deletions Example/IRLSizeExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,6 @@
"$(inherited)",
);
INFOPLIST_FILE = "../IRLSizeTests/IRLSizeTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.detroitlabs.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = xctest;
Expand All @@ -883,7 +882,6 @@
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
INFOPLIST_FILE = "../IRLSizeTests/IRLSizeTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.detroitlabs.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = xctest;
Expand Down
2 changes: 1 addition & 1 deletion IRLSize.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Pod::Spec.new do |s|
s.dependency 'SDVersion', '~> 4.3.0'

s.test_spec 'IRLSizeTests' do |ts|
ts.platform = :ios, '10.0'
ts.platform = :ios, '8.0'
ts.source_files = 'IRLSizeTests/*.{h,m}'
ts.dependency 'Kiwi'
ts.requires_app_host = true
Expand Down
5 changes: 3 additions & 2 deletions IRLSizeTests/IRLMeasurementBeWithinMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
// Copyright © 2018 Detroit Labs. All rights reserved.
//

#import <IRLSize/IRLSize.h>
#import <Kiwi/Kiwi.h>

NS_ASSUME_NONNULL_BEGIN

@interface IRLMeasurementBeWithinMatcher : KWMatcher

- (void)beWithin:(double)aDistance ofMeasurement:(NSMeasurement *)aValue;
- (void)equalMeasurement:(NSMeasurement *)aValue withDelta:(double)aDelta;
- (void)beWithin:(double)aDistance ofMeasurement:(NSMeasurement *)aValue IRL_IOS_AVAILABLE(10.0);
- (void)equalMeasurement:(NSMeasurement *)aValue withDelta:(double)aDelta IRL_IOS_AVAILABLE(10.0);

@end

Expand Down
21 changes: 14 additions & 7 deletions IRLSizeTests/IRLMeasurementBeWithinMatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#import "NSMeasurement+Equality.h"

IRL_IOS_AVAILABLE(10.0)
@interface IRLMeasurementBeWithinMatcher()

@property (nonatomic, readwrite) double distance;
Expand All @@ -37,13 +38,19 @@ + (NSArray *)matcherStrings

- (BOOL)evaluate
{
NSMeasurement *subject = self.subject;

NSAssert([subject isKindOfClass:[NSMeasurement class]],
@"This matcher can only be used on NSMeasurement instances.");

return [subject irl_isEqualToMeasurement:self.otherValue
withDelta:self.distance];
if (@available(iOS 10.0, *)) {
NSMeasurement *subject = self.subject;

NSAssert([subject isKindOfClass:[NSMeasurement class]],
@"This matcher can only be used on NSMeasurement instances.");

return [subject irl_isEqualToMeasurement:self.otherValue
withDelta:self.distance];
}
else {
NSAssert(false, @"This matcher requires iOS 10 or later.");
return false;
}
}

#pragma mark - Getting Failure Messages
Expand Down
Loading

0 comments on commit 4682341

Please sign in to comment.