rspec-documentation

0.0.11
Light Mode Dark Mode

YAML

If your code outputs YAML, use the ```rspec:yaml formatter to prettify your YAML output. Note that your code must produce a raw YAML string in order to use this formatter, it does not convert Ruby objects into YAML.

Markdown

```rspec:yaml
subject(:yaml) do
  {
    'key' => 'value',
    'array' => [1, 2, 3],
    'boolean' => true,
    'otherBoolean' => false
  }.to_yaml
end

it 'has expected key/value' do
  expect(YAML.safe_load(yaml)).to include({ 'key' => 'value' })
end
```

Output

subject(:yaml) do
  {
    'key' => 'value',
    'array' => [1, 2, 3],
    'boolean' => true,
    'otherBoolean' => false
  }.to_yaml
end

it 'has expected key/value' do
  expect(YAML.safe_load(yaml)).to include({ 'key' => 'value' })
end
---
key: value
array:
- 1
- 2
- 3
boolean: true
otherBoolean: false

Documentation generated by rspec-documentation