rspec-file_fixtures

0.1.9
Light Mode Dark Mode

JSON

JSON fixtures can be parsed into a Ruby object using the #from_json method.

This is equivalent to JSON.parse(..., symbolize_names: true).

subject { fixture('example.json').from_json }

it { is_expected.to eql({ key: 'value' }) }
{:key=>"value"}

Symbolized Names

Keys are symbolized by default. If you prefer to work with strings, pass symbolize_names: false:

subject { fixture('example.json').from_json(symbolize_names: false) }

it { is_expected.to eql({ 'key' => 'value' }) }
{"key"=>"value"}

Documentation generated by rspec-documentation