Skip to content

Conversation

@lukearndt
Copy link

Context:

When config.snapshot_dir is set to :relative (the default option),
rspec-snapshot stores snapshots in a location relative to the spec file.

Prior to this commit, that relative snapshot location was hard-coded to
a __snapshots__ subdirectory and the application had no way to choose
anything else.

Changes:

This commit adds a new config option that allows the caller to specify
a subdirectory when config.snapshot_dir is set to :relative.

The new config option supports the following values:

  • String: a path to a different subdirectory

  • nil: stores snapshot files in the same directory as each spec file

In all cases, the caller can still store the snapshot files in a further
subdirectory by calling match_snapshot with a nested snapshot name.

Context:

When `config.snapshot_dir` is set to `:relative` (the default option),
rspec-snapshot stores snapshots in a location relative to the spec file.

Prior to this commit, that relative snapshot location was hard-coded to
a `__snapshots__` subdirectory and the application had no way to choose
anything else.

Changes:

This commit adds a new config option that allows the caller to specify
a subdirectory when `config.snapshot_dir` is set to `:relative`.

The new config option supports the following values:

- String: a path to a different subdirectory

- nil: stores snapshot files in the same directory as each spec file

In all cases, the caller can still store the snapshot files in a further
subdirectory by calling `match_snapshot` with a nested snapshot name.
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant