File: README.md

package info (click to toggle)
ruby-rspec 3.9.0c2e2m1s3-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,612 kB
  • sloc: ruby: 67,456; sh: 1,572; makefile: 98
file content (13 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
When [allowing](./basics/allowing-messages) or [expecting](./basics/expecting-messages) messages, the default response is to return `nil`. Several
methods are provided to configure how the test double responds to the message.

* <a href="./configuring-responses/returning-a-value">`and_return`</a>
* <a href="./configuring-responses/raising-an-error">`and_raise`</a>
* <a href="./configuring-responses/throwing">`and_throw`</a>
* <a href="./configuring-responses/yielding">`and_yield`</a>
* <a href="./configuring-responses/calling-the-original-implementation">`and_call_original`</a>
* <a href="./configuring-responses/wrapping-the-original-implementation">`and_wrap_original`</a>

In addition, you can provide a [block implementation](./configuring-responses/block-implementation) to respond in any manner you wish.

Note: for simplicity, the examples here use `allow` rather than `expect`, but these APIs apply equally to both cases.