Skip to content

Instantly share code, notes, and snippets.

@badrinathvm
Last active October 14, 2017 20:47
Show Gist options
  • Save badrinathvm/145c446a4b072499294a430ed82944d7 to your computer and use it in GitHub Desktop.
Save badrinathvm/145c446a4b072499294a430ed82944d7 to your computer and use it in GitHub Desktop.
Modal Unit Tests
import Foundation
import Nimble
import Quick
@testable import UnitTests
class Dummy{}
class WatchTest: QuickSpec{
var watchInformation: [Watch] = []
var watch : Watch!
override func spec() {
describe("Modal Checks"){
beforeEach {
self.watchInformation = WatchDataHelper.getWatchInformation()
self.watch = self.watchInformation[0]
}
context("When Watch Model Data is available"){
it("Model Type Class Validations on Watch Object "){
//class check
expect(self.watch).to(beAKindOf(Watch.self))
expect(self.watch).toNot(beAKindOf(Dummy.self))
//instance check
expect(self.watch).to(beAnInstanceOf(Watch.self))
expect(self.watch).toNot(beAnInstanceOf(Dummy.self))
}
}
context("Watch Name and Brand checks"){
var brandInformation: Brand!
beforeEach{
brandInformation = self.watch.brand
}
it("Watch Name and Brand validations") {
//string and name presence check
expect(self.watch.name).to(beAnInstanceOf(String.self))
expect(self.watch.name).to(contain("Men's Business Quartz Watch CAGNARY 6828"))
expect(brandInformation.name).to(equal("CAGARNY"))
expect(brandInformation.name).toNot(beNil())
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment