This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AmountSettingViewModelSpec: QuickSpec { | |
override func spec() { | |
var viewModel: AmountSettingViewModel! | |
beforeEach { | |
viewModel = AmountSettingViewModel(amountText: Observable<String>.just("120"), | |
submitButtonTap: Observable<Void>.just()) | |
} | |
it("should be button ebanled") { | |
let enable = try! viewModel.submitButtonEnable.toBlocking().single() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Quick | |
import Nimble | |
import RxTest | |
import RxBlocking | |
import RxSwift | |
import RxCocoa | |
import Result | |
@testable import customer | |
class SigninViewModelSpec: QuickSpec { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let request = UserAPIRequest(id: 1) // APIKit | |
let username = URLSession.shared.rx.object(request: request) | |
.map { user in // Himotoki | |
return user.name | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PersonSpec: QuickSpec { | |
override func spec() { | |
describe("Person"){ | |
describe("成人判定") { | |
itBehavesLike("is成人") { | |
let p = Person(name: "_", age: 21) | |
return ["person": p] | |
} | |
itBehavesLike("is成人") { ["person": Person(name: "_", age: 999)] } | |
itBehavesLike("not成人") { ["person": Person(name: "_", age: 19)] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Charge { | |
static var stubObjects: [Charge] { | |
let JSON = json(from: "Fixtures/charges.json") | |
return try! decodeArray(JSON, rootKeyPath: "data") | |
} | |
} | |
struct MockWebAPI: HomeAPIProtocol { | |
func getCharges() -> Observable<[Charge]> { | |
return Observable.from(Charge.stubObjects) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeViewModel { | |
let charges = Variable<[Charge]>([]) | |
let didAppear = PublishSubject<Void>() | |
let disposeBag = DisposeBag() | |
init(with state: AppState) { | |
guard let api = state.webAPI else { fatalError("error") } | |
let _ = didAppear.flatMapLatest { api.getCharges() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CLibmemcached | |
struct Memcached { | |
func connection() -> UnsafeMutablePointer<memcached_st> { | |
let memc1 = CLibmemcached.memcached_create(nil) | |
assert(memc1 != nil) // OK | |
let config = "--SERVER=localhost:11211" | |
var configPtr = [Int8](config.utf8CString) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compile Swift Module 'Quick' (21 sources) | |
Compile Swift Module 'Nimble' (45 sources) | |
Compile Swift Module 'Result' (2 sources) | |
Compile Swift Module 'ReactiveSwift' (19 sources) | |
Compile Swift Module 'ReactiveSwiftTests' (18 sources) | |
/app/Tests/ReactiveSwiftTests/SchedulerSpec.swift:92:5: error: value of type 'Expectation<[Int]>' (aka 'Expectation<Array<Int>>') has no member 'toEventually' | |
expect(values).toEventually(equal([ 0 ])) | |
^~~~~~~~~~~~~~ ~~~~~~~~~~~~ | |
/app/Tests/ReactiveSwiftTests/SchedulerSpec.swift:109:5: error: value of type 'Expectation<[Int]>' (aka 'Expectation<Array<Int>>') has no member 'toEventually' | |
expect(values).toEventually(equal([ 0, 1, 2 ])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let authenticationNeeded = try! viewModel.authenticationNeeded.asObservable().toBlocking() | |
expect(try! authenticationNeeded.first()).to(beFalse()) | |
state.notificationCenter.post(name: Notification.Name.UIApplicationDidBecomeActive, object: nil) | |
expect(try! authenticationNeeded.last()).to(beTrue()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "open-uri" | |
class Converter | |
RE_MD_IMAGE = /\!\[.*\]\((http.+)\)/ | |
RE_TAG_IMAGE = /<img .*src="(http.+?)".+?>/ | |
def initialize(file, conf) | |
@conf = conf |