Skip to content

Instantly share code, notes, and snippets.

Avatar

Hoang Tran hoang-tran

View GitHub Profile
View bdd_1.md

describe a Gun

  • describe shoot
  • describe lock
  • describe unlock
View bdd_3.md

describe Gun

  • describe shoot
    • when has bullets
      • when is unlocked
      • when is locked
    • when has no bullet
  • describe lock
  • describe unlock
View bdd_2.md

describe a Gun

  • describe shoot
    • when has bullets
    • when has no bullet
  • describe lock
  • describe unlock
View bdd_4.md

describe Gun

  • describe shoot
    • when has bullets
      • when is unlocked
        • it can shoot
      • when is locked
        • it cannot shoot
    • when has no bullet
      • it cannot shoot
  • describe lock
View MyNativeTests.swift
import XCTest
@testable import MyAwesomeProject
class MyNativeTests: XCTestCase {
func testGunCanShootIfItHasBullets() {
// 1. Setup: create a gun with 1 bullet
let gun = Gun(bullets: 1)
// 2. Execution: shoot
gun.shoot()
View Gun.swift
import Foundation
class Gun: NSObject {
var bullets = 0
init(bullets: Int) {
self.bullets = bullets
}
View native_tests_modified.swift
import XCTest
class MyNativeTests: XCTestCase {
func testSomething() {
}
}
View native_tests.swift
import XCTest
class MyNativeTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
View vim regex.md

Match

. : match any single character
* : match 0 or more times
\+ : match 1 or more times
\= : match 0 or 1 time (match optional)
\( : open group
\) : close group

Count

View Podfile (objC).rb
platform :ios, '9.0'
target 'MyAwesomeProject' do
target 'MyAwesomeProjectTests' do
inherit! :search_paths
pod 'Specta'
pod 'Expecta'
end
end