rspec-file_fixtures

0.1.9
Light Mode Dark Mode

YAML

YAML fixtures can be parsed into a Ruby object using the #from_yaml method.

This is equivalent to YAML.safe_load(..., symbolize_names: true).

subject { fixture('example.yaml').from_yaml }

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.yaml').from_yaml(symbolize_names: false) }

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

Documentation generated by rspec-documentation