Use only two line header:
//
// Copyright © 2015 Mobile Academy. All rights reserved.
//
Class template proposal:
class Foo {
//MARK: Constants
let key = "FOO BAR 123"
//MARK: Properties
var foo: String?
//MARK: Initialisers
init() {
}
//MARK: Public methods
func doSomethingWith(foo: Sting) -> Bool {
return false
}
//MARK: Private methods
func someCalculation() -> Int {
return 1+1
}
}
Spec template proposal:
import Quick
import Nimble
@testable
import TDDWorkshop
class PhotoStreamViewControllerSpec: QuickSpec {
override func spec() {
describe("PhotoStreamViewController") {
var photoStreamViewController: PhotoStreamViewController!
beforeEach {
photoStreamViewController = PhotoStreamViewController()
}
it("should work") {
expect(true) == true
}
}
}
}
Add suffix Fake
to the class fake, e.g Foo
should have FooFake
.
Subject under test variables should be declared as explicitly unwrapped (it's really bad if your sut
is nil):
var foo: Bar!
beforeEach {
foo = Bar()
}
Other variables should be declared as optionals:
var foo: Bar?
beforeEach {
foo = (...)
}
Copyright © 2015 Mobile Academy. All rights reserved.