-
Notifications
You must be signed in to change notification settings - Fork 15
/
ConfigurationSpec.swift
63 lines (54 loc) · 2.59 KB
/
ConfigurationSpec.swift
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
59
60
61
62
63
//
// ConfigurationSpec.swift
// FBSnapshotsViewer
//
// Created by Anton Domashnev on 14.05.17.
// Copyright © 2017 Anton Domashnev. All rights reserved.
//
import Quick
import Nimble
import Foundation
@testable import FBSnapshotsViewer
class ConfigurationSpec: QuickSpec {
override func spec() {
var configuration: FBSnapshotsViewer.Configuration!
describe(".default") {
it("returns xcodeDefault configuration") {
expect(Configuration.default()).to(equal(Configuration.init(derivedDataFolder: DerivedDataFolder.xcodeDefault)))
}
}
describe(".init") {
it("initializes new configuration") {
let derivedDataFolder = DerivedDataFolder.xcodeCustom(path: "Foo")
expect(Configuration(derivedDataFolder: derivedDataFolder).derivedDataFolder).to(equal(derivedDataFolder))
}
}
describe(".decoding") {
it("archives and unarchives the xcodeCustom configuration") {
configuration = Configuration(derivedDataFolder: DerivedDataFolder.xcodeCustom(path: "Foo"))
let data: Data! = NSKeyedArchiver.archivedData(withRootObject: configuration)
let unarchivedConfiguration = NSKeyedUnarchiver.unarchiveObject(with: data)
expect(configuration.isEqual(unarchivedConfiguration)).to(beTrue())
}
it("archives and unarchives the appcode configuration") {
configuration = Configuration(derivedDataFolder: DerivedDataFolder.appcode(path: "Foo"))
let data: Data! = NSKeyedArchiver.archivedData(withRootObject: configuration)
let unarchivedConfiguration = NSKeyedUnarchiver.unarchiveObject(with: data)
expect(configuration.isEqual(unarchivedConfiguration)).to(beTrue())
}
}
describe(".isEqual") {
context("when object is not configuration") {
it("returns false") {
expect(Configuration.default().isEqual(NSObject())).toNot(beTrue())
}
}
context("when object is configuration") {
it("compares derived data folder") {
expect(Configuration(derivedDataFolder: DerivedDataFolder.xcodeDefault)).to(equal(Configuration(derivedDataFolder: DerivedDataFolder.xcodeDefault)))
expect(Configuration(derivedDataFolder: DerivedDataFolder.xcodeDefault)).toNot(equal(Configuration(derivedDataFolder: DerivedDataFolder.xcodeCustom(path: "Foo"))))
}
}
}
}
}