Skip to content

Instantly share code, notes, and snippets.

We changed it from @HOME.URL@ to @HOME_URL@
/**
* Useful build-time constants.
* This file is generated as part of the production release process,
* overriding defaults configured for use in a development environment.
*
* Any local changes to this file are therefore subject to being overwritten
* by use of the ant build process, and may not survive a source check-in for
* very long.
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'android-sdk-manager'
apply plugin: 'android'
task generateConfigFile(type: Copy) {
// Build config file from environment variables
// this task doesn't get executed automatically. You have to run it explicitly. (Jenkins does this)
from 'build.config/Config.java'
into 'iTriageLib/src/com/healthagen/iTriage'
@joesus
joesus / gist:0f7ce91e65b9ba0a04875bbf5bd0c502
Created June 16, 2017 21:40
KittenAdoptR ViewControllerTests1
import XCTest
class ViewControllerTests: XCTestCase {
}
@joesus
joesus / gist:2ee10b18d93b91bd624060f305ea6300
Last active June 16, 2017 22:23
KittenAdoptR ViewControllerTests2
func testControllerHasTableView() {
guard let controller = UIStoryboard(name: "Main", bundle: Bundle(for: ViewController.self)).instantiateInitialViewController() as? ViewController else {
return XCTFail("Could not instantiate ViewController from main storyboard")
}
controller.loadViewIfNeeded()
XCTAssertNotNil(controller.tableView,
"Controller should have a tableview")
}
func testTableViewDataSourceIsKittenDataSource() {
guard let controller = UIStoryboard(name: "Main", bundle: Bundle(for: ViewController.self)).instantiateInitialViewController() as? ViewController else {
return XCTFail("Could not instantiate ViewController from main storyboard")
}
controller.loadViewIfNeeded()
XCTAssertTrue(controller.tableView.dataSource is KittenDataSource,
"TableView's data source should be a KittenDataSource")
}
import XCTest
@testable import KittenAdoptR
class KittenTests: XCTestCase {
func testKittenHasAName() {
let kitten = Kitten(name: "Uncle Fester")
XCTAssertEqual(kitten.name, "Uncle Fester",
"Kitten name should be set in initializer")
}
import XCTest
@testable import KittenAdoptR
class KittenDataSourceTests: XCTestCase {
var dataSource: KittenDataSource!
override func setUp() {
super.setUp()
dataSource = KittenDataSource()
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return kittens.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
cell.textLabel?.text = kittens[indexPath.row].name
return cell
}
func testCellForRow() {
let tableView = UITableView()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
let cell = dataSource.tableView(tableView, cellForRowAt: IndexPath(row: 0, section: 0))
XCTAssertEqual(cell.textLabel?.text, "Kitten: 0",
"The first cell should display name of first kitten")
}
func testHasZeroSectionsWhenZeroKittens() {
dataSource.kittens = []
let tableView = UITableView()
XCTAssertEqual(dataSource.numberOfSections(in: tableView), 0,
"TableView should have zero sections when no kittens are present")
}