Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loading from .fixtures.yaml too #110

Merged
merged 1 commit into from
Jul 27, 2015
Merged

Support loading from .fixtures.yaml too #110

merged 1 commit into from
Jul 27, 2015

Conversation

daenney
Copy link
Contributor

@daenney daenney commented Jul 27, 2015

YAML can have multiple extensions, .yml and .yaml. Hiera has used
.yaml all over the place but for some reason the spec_helper gets
extremely sad (it doesn't load anything) when you have a .fixtures.yaml
instead. This is annoying for the end user and easily dealt with in code.

Additionally we now actually catch Psych::SyntaxError and abort in
that case instead of just checking for Error::ENOENT and returning
before. I'm not even sure if the if not fixtures would ever be
triggered since a syntax error would actually raise an error we
were not rescuing.

YAML can have multiple extensions, .yml and .yaml. Hiera has used
.yaml all over the place but for some reason the spec_helper gets
extremely sad when you have a fixtures.yaml instead. This is
annoying for the end user and easily dealt with in code.

Additionally we now actually catch Psych::SyntaxError and abort in
that case instead of just checking for `Error::ENOENT` and returning
before. I'm not even sure if the `if not fixtures` would ever be
triggered since a syntax error would actually raise an error we
were not rescuing.
rescue Error::ENOENT
return {}
rescue Psych::SyntaxError
abort("malformed #{fixtures_yaml}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to give the raised error message from psych here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with #111

hunner added a commit that referenced this pull request Jul 27, 2015
Support loading from .fixtures.yaml too
@hunner hunner merged commit 7219cb4 into puppetlabs:master Jul 27, 2015
@daenney daenney deleted the fixtures-yaml branch July 27, 2015 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants