Skip to content

Commit

Permalink
Added 'hour in year' test
Browse files Browse the repository at this point in the history
  • Loading branch information
belkevich committed Aug 22, 2015
1 parent 56bfac9 commit 3f86d50
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Pod/NSDate+Calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
#import "NSDate+Month.h"
#import "NSDate+Week.h"
#import "NSDate+Day.h"
#import "NSDate+Time.h"
#import "NSDate+Time.h"
#import "NSDate+Hour.h"
4 changes: 4 additions & 0 deletions Spec/Spec.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
2DBA1E35BE3A586792EF36AA /* NSDate+Components.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DBA123E03D2A1C78BBE8153 /* NSDate+Components.m */; };
2DBA1F5558C62448A5ABEC1F /* NSDate+CompareSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DBA1761C8A4FDE14104E1DA /* NSDate+CompareSpec.mm */; };
DE7F58AE300A34718D6F131D /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C16E712F1DCA3C3825477DF /* libPods.a */; };
FAE8B2B01B888452006FC74B /* NSDate+HourSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DBA16E9A7A5A0C0FA04AD2F /* NSDate+HourSpec.mm */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -52,6 +53,7 @@
2DBA15F3232962A90CEDE304 /* NSDate+Components.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Components.h"; sourceTree = "<group>"; };
2DBA15FC524281248FE360CF /* NSDate+Time.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+Time.m"; sourceTree = "<group>"; };
2DBA1623E13AD385244B6FD0 /* NSDate+Hour.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Hour.h"; sourceTree = "<group>"; };
2DBA16E9A7A5A0C0FA04AD2F /* NSDate+HourSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+HourSpec.mm"; sourceTree = "<group>"; };
2DBA1761C8A4FDE14104E1DA /* NSDate+CompareSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+CompareSpec.mm"; sourceTree = "<group>"; };
2DBA17B39EE1743EDE5C2409 /* NSDate+DaySpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+DaySpec.mm"; sourceTree = "<group>"; };
2DBA18724F119F0E9B9B20CD /* NSDate+Time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Time.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -95,6 +97,7 @@
2DBA1AA5D53D3D28AA6FA71D /* NSDate+TimeSpec.mm */,
2DBA125738A44804D3282A39 /* NSDate+WeekSpec.mm */,
2DBA1D5048796BAAC201E374 /* NSDate+YearSpec.mm */,
2DBA16E9A7A5A0C0FA04AD2F /* NSDate+HourSpec.mm */,
);
path = Spec;
sourceTree = "<group>";
Expand Down Expand Up @@ -271,6 +274,7 @@
buildActionMask = 2147483647;
files = (
2DBA13B86A33723108B6CE74 /* NSDate+Day.m in Sources */,
FAE8B2B01B888452006FC74B /* NSDate+HourSpec.mm in Sources */,
2DBA11CB980B6EA4EA0BCB42 /* NSDate+Hour.m in Sources */,
2DBA18E2A19BAEB826C6F193 /* NSDate+Time.m in Sources */,
2DBA11CA8E8106957E0497FF /* NSDate+Week.m in Sources */,
Expand Down
35 changes: 35 additions & 0 deletions Spec/Spec/Spec/NSDate+HourSpec.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// NSDate+HourSpec.mm
// Spec
//
// Created by Alexey Belkevich on 22.08.15.
// Copyright (c) 2015 Okolodev. All rights reserved.
//

#import <Cedar/Cedar.h>
#import "NSDate+Hour.h"

using namespace Cedar::Matchers;
using namespace Cedar::Doubles;

SPEC_BEGIN(NSDateHourSpec)

describe(@"Date with hour", ^
{
__block NSDate *date;
__block NSDateFormatter *formatter;

beforeEach((id)^
{
formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd-MM-y HH:mm:ss"];
date = [formatter dateFromString:@"01-01-2015 17:25:14"];
});

it(@"should get hour in year", ^
{
date.hourInYear should equal(18);
});
});

SPEC_END

0 comments on commit 3f86d50

Please sign in to comment.