rspec-documentation

0.0.11
Light Mode Dark Mode

JSON

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

Markdown

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

it 'has expected key/value' do
  expect(JSON.parse(json)).to include({ 'key' => 'value' })
end
```

Output

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

it 'has expected key/value' do
  expect(JSON.parse(json)).to include({ 'key' => 'value' })
end
{
  
"key": "value",
  
"array": [
    
1,
    
2,
    
3
  
],
  
"boolean": true,
  
"otherBoolean": false
}

Documentation generated by rspec-documentation