Releases: trivago/Dobby
0.6.2
0.7.0
This release targets Xcode 8.0 / Swift 3.0.
0.6.0
This release targets Xcode 8.0 / Swift 2.3.
0.5.0
This release targets Xcode 7.3 / Swift 2.2.
0.4.2
Fixed a bug where nice, ordered mocks would ignore the order of expectations and updated the README.md
.
0.4.1
Dobby has been updated for Swift 2.1 and now inherits jspahrsummers/xcconfigs
. Dependencies are managed explicitly using submodules, adding support for jspahrsummers/objc-build-scripts
.
The OS X deployment target has been lowered to 10.9
. tvOS support will be added soon.
0.4
Dobby has been updated for Swift 2.0 and supports installation via CocoaPods!
0.4-alpha.1
Dobby has been updated for Swift 2.0!
0.3
This release comes with quite a few nice additions:
- Added fast failing to mocks #21
- Added optional support for unordered expectations #20
- Added optional support for nice mocks #22
- Added support for verification with delay #24
- Added support for negative expectations #25
- Improved support for optionals #23
- Updated Nimble to 1.0.0
Please also note that Expectation
has been renamed to Matcher
, hopefully not affecting you much!
0.2
So, this is almost a complete rewrite, adding a few new features but more importantly fixing many pain points we encountered internally. Here is a summary of the changes:
Expectations
Argument<T: Equatable>
and Interaction*<...>
have been merged into Expectation<Value>
, which no longer requires its value to be equatable. Instead, matching is now entirely closure-based and the framework ships with a handful of convenience functions, also for equatable types. Expectations can be nested!
let mock = Mock<(Int, Int, Int, NSURL)>()
mock.expect(matches((any(), equals(1), 2, matches { $0.absoluteString == "http://www.rheinfabrik.de" })))
Mocks
The usage of mocks has been changed to be more like in other frameworks: (1) set expectations, (2) record interactions, and (3) verify expectations and interactions. Recording interactions is no longer Argument
based, which was rather confusing. Error messages are awesome 😅
mock.record(0, 0, 2, NSURL(string: "http://www.rheinfabrik.de")!)
mock.verify() // Expectation <(_, 1, 2, <func>)> does not match interaction <(0, 0, 2, http://www.rheinfabrik.de)>
Stubs
Besides simply returning a value, defining interaction-depdent behavior is now possible. Also, defining behavior now returns a disposable, enabling its removal.
let stub = Stub<(Int, Int), Int>()
let disposable = stub.on(matches((4, 3)), returnValue: 9)
stub.on(matches((any(), any()))) { $0.0 + $0.1 }
disposable.dispose()
stub.invoke(4, 3) // .Some(7)
Please check out the source and tests for further documentation.