Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
223 additions
and
139 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
osx_image: xcode7.3 | ||
language: objective-c | ||
cache: cocoapods | ||
podfile: Example/Podfile | ||
rvm: | ||
- 2.3.1 | ||
language: objective-c | ||
cache: | ||
- bundler | ||
- cocoapods | ||
podfile: Example/Podfile | ||
before_install: | ||
- sudo gem install bundler | ||
- bundle install | ||
- pod repo update | ||
- pod install --project-directory=Example | ||
- bundle install | ||
- pod repo remove master | ||
- pod setup | ||
install: | ||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet | ||
- bundle exec pod install --project-directory=Example | ||
script: | ||
- set -o pipefail && xcodebuild test -workspace Example/RxMVC.xcworkspace -scheme RxMVC-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty | ||
- pod lib lint | ||
- > | ||
set -o pipefail && | ||
xcodebuild test | ||
-workspace Example/RxMVC.xcworkspace | ||
-scheme RxMVC-Example | ||
-sdk iphonesimulator9.3 | ||
-jobs `sysctl hw.ncpu | awk '{print 2*$2}'` | ||
ONLY_ACTIVE_ARCH=NO | xcpretty | ||
- pod lib lint | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// UpDownTest.swift | ||
// RxMVC | ||
// | ||
|
||
import XCTest | ||
import RxSwift | ||
import RxBlocking | ||
import RxTests | ||
import RxMVC | ||
|
||
@testable import RxMVC_Example | ||
|
||
class UpDownTest: XCTestCase { | ||
func testModel() { | ||
let model = UpDownModel() | ||
let scheduler = TestScheduler(initialClock: 0) | ||
let xs = scheduler.createHotObservable([ | ||
next(210, UpDownAction.Increase), | ||
next(220, UpDownAction.Increase), | ||
next(230, UpDownAction.Increase), | ||
next(240, UpDownAction.Decrease), | ||
next(250, UpDownAction.Decrease), | ||
next(260, UpDownAction.Reset), | ||
next(270, UpDownAction.Increase), | ||
completed(300) | ||
]) | ||
let res = scheduler.start { model.manipulate(xs.asObservable()) } | ||
let expected = [ | ||
next(200, 0), | ||
next(210, 1), | ||
next(220, 2), | ||
next(230, 3), | ||
next(240, 2), | ||
next(250, 1), | ||
next(260, 0), | ||
next(270, 1), | ||
completed(300) | ||
] | ||
XCTAssertEqual(res.events, expected) | ||
} | ||
|
||
func testController() { | ||
let controller = UpDownController() | ||
let scheduler = TestScheduler(initialClock: 0) | ||
let xs = scheduler.createHotObservable([ | ||
next(210, UpDownEvent.ClickUp), | ||
next(220, UpDownEvent.ClickDown), | ||
next(230, UpDownEvent.ClickReset), | ||
completed(300) | ||
]) | ||
let res = scheduler.start { controller.use(xs.asObservable()) } | ||
let expected = [ | ||
next(210, UpDownAction.Increase), | ||
next(220, UpDownAction.Decrease), | ||
next(230, UpDownAction.Reset), | ||
completed(300) | ||
] | ||
XCTAssertEqual(res.events, expected) | ||
} | ||
} |
Oops, something went wrong.