Skip to content

Commit

Permalink
Adds failing test illustrating crash on UIBarButtonItem tap.
Browse files Browse the repository at this point in the history
  • Loading branch information
lyricsboy authored and kzaher committed Jun 17, 2017
1 parent 60d1d88 commit 342bbd1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Tests/RxCocoaTests/UIBarButtonItem+RxTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import RxTest
import XCTest

final class UIBarButtonItemTests: RxTest {

let disposeBag = DisposeBag()
}

// UIBarButtonItem
Expand All @@ -29,4 +29,14 @@ extension UIBarButtonItemTests {

XCTAssertEqual(button.title, text)
}

func testBarButtonItem_actionExecution() {
let button = UIBarButtonItem()
weak var tapExpectation = expectation(description: "tap")
button.rx.tap.subscribe(onNext: {
tapExpectation?.fulfill()
}).disposed(by: disposeBag)
_ = button.target?.perform(button.action)
waitForExpectations(timeout: 1, handler: nil)
}
}

0 comments on commit 342bbd1

Please sign in to comment.