Skip to content

Commit

Permalink
Added the test case in #227.
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio committed May 15, 2017
1 parent c56cd48 commit 6bbaf16
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Tests/ReactiveSwiftTests/SignalProducerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,27 @@ class SignalProducerSpec: QuickSpec {
startDisposable.dispose()
expect(addedDisposable.isDisposed) == true
}

it("should deliver the interrupted event with respect to the applied asynchronous operators") {
let scheduler = TestScheduler()
var signalInterrupted = false
var observerInterrupted = false

let (signal, _) = Signal<Int, NoError>.pipe()

SignalProducer(signal)
.observe(on: scheduler)
.on(interrupted: { signalInterrupted = true })
.startWithInterrupted { observerInterrupted = true }
.dispose()

expect(signalInterrupted) == false
expect(observerInterrupted) == false

scheduler.run()
expect(signalInterrupted) == true
expect(observerInterrupted) == true
}
}

describe("init(signal:)") {
Expand Down

0 comments on commit 6bbaf16

Please sign in to comment.