Skip to content

Instantly share code, notes, and snippets.

View Serchinastico's full-sized avatar
👋

Sergio Gutiérrez Serchinastico

👋
View GitHub Profile
@Serchinastico
Serchinastico / .gitconfig
Last active June 5, 2018 17:12
Alias for easier git rebase --onto
[alias]
# ronto stands for "rebase --onto". Uses the current branch to move it and updates the start-of-the-branch tag along
ronto = "!f() { \
git rebase --onto $1 __start__$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --abbrev-ref HEAD); \
git tag -d __start__$(git rev-parse --abbrev-ref HEAD); \
git tag __start__$(git rev-parse --abbrev-ref HEAD) $1; \
}; f"
# nb stands for "create branch". Creates a tag marking the start-of-the-branch
cb = "!f() { \
git tag __start__$1; \
@Serchinastico
Serchinastico / SuperHeroControlsViewController.swift
Last active January 17, 2018 20:16
View controller sobre el que haremos las pruebas de las acciones con KIF
// --------------------------------------------- //
// -------------- VIEW CONTROLLER -------------- //
// --------------------------------------------- //
import UIKit
class SuperHeroControlsViewController: UIViewController {
var textField: UITextField!
var slider: UISlider!
@Serchinastico
Serchinastico / SuperHeroesControlsViewControllerTests.swift
Created September 27, 2017 17:13
Clase de test que muestra cómo usar KIF para interactuar con todo tipo de vistas
class SuperHeroesControlsViewControllerTests: AcceptanceTestCase {
func testShowsEmptyCaseIfThereAreNoSuperHeroes() {
openSuperHeroesViewController()
tester().tapView(withAccessibilityLabel: "Button")
tester().setValue(0, forSliderWithAccessibilityLabel: "Slider")
for _ in (0..<10) {
@Serchinastico
Serchinastico / DI - Snapshot.swift
Created September 15, 2017 08:29
Doing dependency injection for our tests
class SuperHeroDetailViewControllerTests: XCTestCase {
private let repository = MockSuperHeroesRepository()
/* ... */
private func openSuperHeroDetailViewController(_ superHeroName: String) -> UIViewController {
let superHeroDetailViewController = ServiceLocator()
.provideSuperHeroDetailViewController(superHeroName) as! SuperHeroDetailViewController
superHeroDetailViewController.presenter = SuperHeroDetailPresenter(ui: superHeroDetailViewController,
@Serchinastico
Serchinastico / DI.swift
Created September 13, 2017 09:49
Inyectando código
class SuperHeroDetailViewControllerTests: XCTestCase {
private let repository = MockSuperHeroesRepository()
/* ... */
private func openSuperHeroDetailViewController(_ superHeroName: String) {
let superHeroDetailViewController = ServiceLocator()
.provideSuperHeroDetailViewController(superHeroName) as! SuperHeroDetailViewController
superHeroDetailViewController.presenter = SuperHeroDetailPresenter(ui: superHeroDetailViewController,