]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Implement rspec function it_raises
authorYanis Guenane <yanis.guenane@enovance.com>
Thu, 15 May 2014 18:40:46 +0000 (14:40 -0400)
committerYanis Guenane <yanis.guenane@enovance.com>
Thu, 15 May 2014 18:42:34 +0000 (14:42 -0400)
On some puppet modules, a it_raises helper is provided. This commit
implements it for puppet-ceilometer.

Change-Id: Ie1c83e09952fed1f114fc07d9944f89e94c413f1

spec/shared_examples.rb [new file with mode: 0644]
spec/spec_helper.rb

diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb
new file mode 100644 (file)
index 0000000..d92156a
--- /dev/null
@@ -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
index e17ce17d648e1b825f2865080be76dc52f4cfb8e..53d4dd02de495692f96839152f6058dfff107ad1 100644 (file)
@@ -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