Skip to content

Fix off-by-one error in validate_augeas_spec.rb that was causing rspec failure #425

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

Merged
merged 1 commit into from
Apr 10, 2015

Conversation

jeffcoat
Copy link

This fixes the test "Nicer Error Messages" in puppetlabs-stdlib/spec/functions/validate_augeas_spec.rb. Without it, 'rake spec' will always fail with RegexpError: empty char-class: /[]/ as Ruby tries and fails to build a pattern off the wrong entry in the inputs array.

I do not understand why I'm the only one to have run into this. But I believe this trivial fix is what the original author intended.

@jeffcoat
Copy link
Author

I see now why this hasn't been noticed before: validate_augeas_spec.rb runs :if => Puppet.features.augeas?.

I was running the tests against my Puppet Enterprise install, so they failed for me, but they're getting skipped in the travis-ci integration build.

@hunner
Copy link
Contributor

hunner commented Apr 9, 2015

Thanks! Could you add the augeas gem to the Gemfile so that this test can run in Travis CI?

@DavidS
Copy link
Contributor

DavidS commented Apr 9, 2015

I've just opened a pull request on the augeas gem to make it compile on more recent installations.

@DavidS
Copy link
Contributor

DavidS commented Apr 9, 2015

Having a working augeas gem, I got the tests running on a Ubuntu 14.04 machine. 10 out of 16 added tests failed with this:

expected Exception with message matching /testing path/, got #<NoMethodError: private method `open' called for Augeas:Class> with backtrace:
  # ./lib/puppet/parser/functions/validate_augeas.rb:44:in `block in <module:Functions>'

That does not look healthy to me.

@DavidS
Copy link
Contributor

DavidS commented Apr 10, 2015

augh, the gem we actually want is 'ruby-augeas ~> 0.5.0'. With that the tests run and this PR in fact fixes two failing test cases. It contains a native extension that won't compile everywhere though :-(

@DavidS DavidS removed the tests-fail label Apr 10, 2015
DavidS added a commit that referenced this pull request Apr 10, 2015
Fix off-by-one error in validate_augeas_spec.rb that was causing rspec failure

Even without the gem installed always, this is helpful to avoid errors should augeas be enabled/installed due to something else.
@DavidS DavidS merged commit afec0ab into puppetlabs:master Apr 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants