mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add test case handling NoReturn stub and top-level methods (exit)
Fixes https://github.com/icy-arctic-fox/spectator/issues/29
This commit is contained in:
parent
92dbfc2a8e
commit
f728ab6ad7
2 changed files with 24 additions and 0 deletions
|
@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Fix `expect().to receive()` syntax not implicitly stubbing the method.
|
||||
- Avoid calling `NoReturn` methods from stubs. [#29](https://github.com/icy-arctic-fox/spectator/issues/29)
|
||||
|
||||
### Added
|
||||
- Added support for `with(no_args)` for method stubs. [#28](https://github.com/icy-arctic-fox/spectator/issues/28)
|
||||
- Allow creation of doubles without definition block. [#30](https://github.com/icy-arctic-fox/spectator/issues/30)
|
||||
|
|
20
spec/issues/github_issue_29_spec.cr
Normal file
20
spec/issues/github_issue_29_spec.cr
Normal file
|
@ -0,0 +1,20 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe "GitHub Issue #29" do
|
||||
class SomeClass
|
||||
def goodbye
|
||||
exit 0
|
||||
end
|
||||
end
|
||||
|
||||
mock SomeClass do
|
||||
stub exit(code)
|
||||
end
|
||||
|
||||
describe SomeClass do
|
||||
it "captures exit" do
|
||||
expect(subject).to receive(:exit).with(0)
|
||||
subject.goodbye
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue