Skip to content

Commit

Permalink
Added a startWithSignal disposal test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio committed Nov 26, 2016
1 parent 3f88617 commit f626658
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/ReactiveSwiftTests/SignalProducerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,23 @@ class SignalProducerSpec: QuickSpec {
observer.send(error: .default)
expect(addedDisposable.isDisposed) == true
}

it("should dispose of the added disposable if the signal is unretained and unobserved upon exiting the scope") {
let addedDisposable = SimpleDisposable()

let producer = SignalProducer<Int, TestError> { _, disposable in
disposable += addedDisposable
}

var started = false

producer
.on(started: { started = true })
.startWithSignal { _ in }

expect(started) == true
expect(addedDisposable.isDisposed) == true
}
}

describe("start") {
Expand Down

0 comments on commit f626658

Please sign in to comment.