Light Mode Dark Mode


RSpec::FileFixtures provides a helper named fixture available in all specs. This method receives a filename as a string and the provided file is loaded from spec/fixtures/.

Fetch the fixture’s path:

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

it { end_with '/spec/fixtures/example.yaml' }

Read the fixture’s content:

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

it { include 'key: value' }
key: value

A number of extensions are provided to assist dealing with common data types. See each item in the Usage section for details.

Documentation generated by rspec-documentation