Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nepalez committed Jun 4, 2019
1 parent 5c97990 commit a5beaf7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.0.5] - WIP

### Added

- The support for stubbing constants (nepalez)

```yaml
# Stub constant TIMEOUT_SEC to 10
---
- const: TIMEOUT_SEC
value: 10
```
## [0.0.4] - [2018-05-22]
### Added
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,20 @@ The seed (`seed_fixture`) file should be a YAML/JSON with opinionated parameters
Use the `count: 2` key to create more objects at once.

Another opinionated format we use for stubs (`stub_fixture`):
Another opinionated format we use for stubs (`stub_fixture`). The gem supports stubbing both message chains and constants.

For message chains:

- `class` for stubbed class
- `chain` for messages chain
- `arguments` (optional) for specific arguments
- `actions` for an array of actions for consecutive invocations of the chain

For constants:

- `const` for stubbed constant
- `value` for a value of the constant

Every action either `return` some value, or `raise` some exception

```yaml
Expand Down Expand Up @@ -126,6 +133,9 @@ Every action either `return` some value, or `raise` some exception
actions:
- return: true
- raise: ActiveRecord::RecordNotFound
- const: NOTIFIER_TIMEOUT_SEC
value: 10
```

```graphql
Expand Down

0 comments on commit a5beaf7

Please sign in to comment.