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

version 2 raise_error no longer catches errors. #254

Closed
mkrakowitzer opened this issue Feb 8, 2015 · 4 comments
Closed

version 2 raise_error no longer catches errors. #254

mkrakowitzer opened this issue Feb 8, 2015 · 4 comments

Comments

@mkrakowitzer
Copy link

This currently works with 1.0.1

it('should fail') {
  expect { should }.to raise_error(Puppet::Error, /Must pass javahome to Class\[Confluence\]/)
}

when running on version 2 I get

  1) confluence with javahome not set should fail
     Failure/Error: expect { should }.to raise_error(Puppet::Error, /Must pass javahome to Class\[Confluence\]/)
       expected Puppet::Error with message matching /Must pass javahome to Class\[Confluence\]/ but nothing was raised
     # ./spec/classes/confluence_spec.rb:6:in `block (3 levels) in <top (required)>'
@logicminds
Copy link

Did this get fixed? I was seeing the same thing and worked around the issue by doing the following.

    it { expect { should compile }.to raise_error(/not supported/) }

The following used to work

    it { expect { should compile }.to raise_error(Puppet::Error, /not supported/) }

@Aethylred
Copy link

Does this form work better:

it { should raise_error(Puppet::Error, /not supported/) }

@logicminds
Copy link

its the same but its just using rspec 2 instead of rspec 3 expect syntax. They both do the same thing.

@mkrakowitzer
Copy link
Author

Thank you, both suggestions resolved my issue.

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

No branches or pull requests

3 participants