Skip to content

Commit

Permalink
Implement rspec function it_raises
Browse files Browse the repository at this point in the history
On some puppet modules, a it_raises helper is provided. This commit
implements it for puppet-ceilometer.

Change-Id: Ie1c83e09952fed1f114fc07d9944f89e94c413f1
(cherry picked from commit 9ec5122)
  • Loading branch information
Spredzy authored and Mike Dorman committed Sep 29, 2014
1 parent 0d72487 commit cd988a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/shared_examples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
shared_examples_for "a Puppet::Error" do |description|
it "with message matching #{description.inspect}" do
expect { should have_class_count(1) }.to raise_error(Puppet::Error, description)
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'shared_examples'

RSpec.configure do |c|
c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises'
end

0 comments on commit cd988a6

Please sign in to comment.