Skip to content

Instantly share code, notes, and snippets.

View fabiothiroki's full-sized avatar
👋

Fabio Hiroki fabiothiroki

👋
View GitHub Profile
@fabiothiroki
fabiothiroki / .travis.yml
Created October 24, 2017 01:39
Travis yml finally
osx_image: xcode9
language: objective-c
cache:
- bundler
- cocoapods
script:
- xcodebuild clean test -quiet -workspace Foursquare\ Clone.xcworkspace -scheme Foursquare\ Clone -destination 'platform=iOS Simulator,name=iPhone 5s'
- bundle exec danger
@fabiothiroki
fabiothiroki / .swiftlint.yml
Created October 24, 2017 01:37
Swiftlint excluding external dependences
excluded:
- Carthage
- Pods
@fabiothiroki
fabiothiroki / Dangerfile
Created October 24, 2017 01:22
Basic Danger configuration
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? "#trivial"
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500
@fabiothiroki
fabiothiroki / Gemfile
Created October 24, 2017 01:14
Gemfile for Danger
source "https://rubygems.org"
ruby '2.3.4'
gem 'danger-swiftlint'
gem 'cocoapods'
@fabiothiroki
fabiothiroki / travis_coverage.yml
Created October 22, 2017 16:35
Travis config with code coverage support
osx_image: xcode9
language: objective-c
cache:
- bundler
- cocoapods
script:
- xcodebuild clean test -quiet -workspace Foursquare\ Clone.xcworkspace -scheme Foursquare\ Clone -destination 'platform=iOS Simulator,name=iPhone 5s'
after_success:
@fabiothiroki
fabiothiroki / .travis.yml
Last active October 18, 2017 01:50
Simple travis configuration for tests
osx_image: xcode9
language: objective-c
cache:
- bundler
- cocoapods
script:
- xcodebuild clean test -quiet -workspace Foursquare\ Clone.xcworkspace -scheme Foursquare\ Clone -destination 'platform=iOS Simulator,name=iPhone 5s'
@fabiothiroki
fabiothiroki / FirstTests.swift
Last active October 28, 2017 20:31
First Tests of UserLocationService
func testDependencyDelegateShouldBeWrapperClass() {
let locationManager = container.resolve(LocationManager.self)!
let userLocationService: UserLocationService = container.resolve(UserLocationService.self)!
XCTAssertTrue(locationManager.delegate === userLocationService)
}
func testShouldRequestUserPermission() {
guard let locationManager = container.resolve(LocationManager.self)! as? LocationManagerMock else {
XCTFail("Error resolving container dependencies")
@fabiothiroki
fabiothiroki / ContainerConfig.swift
Last active October 16, 2017 21:18
Registering dependencies in the container
import XCTest
import Swinject
class UserLocationServiceSpec: XCTestCase {
var container: Container!
override func setUp() {
super.setUp()
container = Container()
@fabiothiroki
fabiothiroki / LocationManagerMock.swift
Created October 13, 2017 14:00
First Version of Location Manager Mock
import CoreLocation
class LocationManagerMock: LocationManager {
var delegate: CLLocationManagerDelegate?
func requestWhenInUseAuthorization() {}
func requestLocation() {}
}
@fabiothiroki
fabiothiroki / ConstructorInjection.swift
Last active December 27, 2017 23:29
Constructor Injection Example
// Initial implementation of UserLocationService
class UserLocationService: NSObject {
fileprivate var locationManager: CLLocationManager
init(locationManager: CLLocationManager) {
self.locationManager = locationManager
super.init()
}
}