You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
abstract_target 'MobileProjectDefault' do
pod 'AFNetworking', '>2.6.0'
pod 'SDWebImage', '>3.7'
pod 'JSONModel', '> 1.0.1'
pod 'Masonry','>0.6.1'
pod 'FMDB/common' , '>2.5'
pod 'FMDB/SQLCipher', '>2.5'
pod 'CocoaLumberjack', '~> 2.0.0-rc'
pod 'ReactiveCocoa', '2.5'
pod 'CYLTabBarController'
pod 'MLeaksFinder' #可以把它放在MobileProject_Local的target中 这样就不会影响到产品环境
pod 'RealReachability'
target 'MobileProject_Local' do
end
target 'MobileProject' do
target 'MobileProjectTests' do
inherit! :search_paths
pod 'Kiwi', '~> 2.3.1'
end
end
1:testLoginViewModel.m
(RACSignal *)isValidUsernameAndPasswordSignal
{
return [RACSignal combineLatest:@[RACObserve(self, username), RACObserve(self, password)] reduce:^(NSString *username, NSString *password) {
return @([self isValidEmail:username] && [self isValidPassword:password]);
}];
}
//验证
(BOOL)isValidEmail:(NSString )data
{
NSString emailPattern =
@"(?:[a-z0-9!#$%&'+/=?^{|}~-]+(?:\.[a-z0-9!#$%\&'*+/=?\^{|}"
@"~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-"
@"x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:[a-z0-9](?:[a-"
@"z0-9-][a-z0-9])?.)+a-z0-9?|[(?:(?:25[0-5"
@"]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-"
@"9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21"
@"-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])";
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:emailPattern options:NSRegularExpressionCaseInsensitive error:&error];
NSTextCheckingResult *match = [regex firstMatchInString:data options:0 range:NSMakeRange(0, [data length])];
return match != nil;
}
(BOOL)isValidPassword:(NSString *)password
{
return password.length >= 6;
}
2:I do unit testing on the above file,But it has been reporting the problem above;[RACStream(Operations) reduceEach:]_block_invoke
#import <Kiwi/Kiwi.h>
#import <ReactiveCocoa/ReactiveCocoa.h>
#import "testLoginViewModel.h"
SPEC_BEGIN(testLoginViewModelSpec)
describe(@"testLoginViewModel", ^{
__block testLoginViewModel* viewModel = nil;
beforeEach(^{
viewModel = [testLoginViewModel new];
});
afterEach(^{
viewModel = nil;
});
context(@"when username is wujunyang and password is freedom", ^{
__block BOOL result = NO;
});
});
SPEC_END
Where is the problem?
The text was updated successfully, but these errors were encountered: