/
GTConfigurationSpec.m
58 lines (44 loc) · 1.27 KB
/
GTConfigurationSpec.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// GTConfigurationSpec.m
// ObjectiveGitFramework
//
// Created by Josh Abernathy on 3/27/13.
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
//
@import ObjectiveGit;
@import Nimble;
@import Quick;
#import "QuickSpec+GTFixtures.h"
QuickSpecBegin(GTConfigurationSpec)
describe(@"+defaultConfiguration", ^{
static NSString * const testKey = @"universe.answer";
static NSString * const testValue = @"42, probably";
__block GTConfiguration *config;
beforeEach(^{
config = [GTConfiguration defaultConfiguration];
expect(config).notTo(beNil());
});
it(@"should return nil for -remotes", ^{
expect(config.remotes).to(beNil());
});
it(@"should support reading and writing", ^{
id value = [config stringForKey:testKey];
expect(value).to(beNil());
[config setString:testValue forKey:testKey];
value = [config stringForKey:testKey];
expect(value).to(equal(testValue));
});
it(@"should support deletion", ^{
[config setString:testValue forKey:testKey];
id value = [config stringForKey:testKey];
expect(value).notTo(beNil());
BOOL success = [config deleteValueForKey:testKey error:NULL];
expect(@(success)).to(beTruthy());
value = [config stringForKey:testKey];
expect(value).to(beNil());
});
});
afterEach(^{
[self tearDown];
});
QuickSpecEnd