diff --git a/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb b/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb index 27cd6b3df..e6b1bf9c7 100644 --- a/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +++ b/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb @@ -1,46 +1,46 @@ dir = File.expand_path(File.dirname(__FILE__)) [ "#{dir}/../../lib", "#{dir}/../../test/lib"].each do |dir| fulldir = File.expand_path(dir) $LOAD_PATH.unshift(fulldir) unless $LOAD_PATH.include?(fulldir) end require 'spec' require 'puppettest' require 'puppettest/runnable_test' module Spec module Runner class ExampleGroupRunner def run prepare success = true example_groups.each do |example_group| unless example_group.runnable? warn "Skipping unsuitable example group %s: %s" % [example_group.description, example_group.messages.join(", ")] next end - success = success & example_group.run + success = success & example_group.run(@options) end return success ensure finish end end end end module Spec module Example class ExampleGroup extend PuppetTest::RunnableTest end end end module Test module Unit class TestCase extend PuppetTest::RunnableTest end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 41b5e7443..e3afd6f3e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,47 +1,48 @@ dir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift("#{dir}/") $LOAD_PATH.unshift("#{dir}/../lib") $LOAD_PATH.unshift("#{dir}/../test/lib") # Add the old test dir, so that we can still find our local mocha and spec # include any gems in vendor/gems Dir["#{dir}/../vendor/gems/**"].each do |path| libpath = File.join(path, "lib") if File.directory?(libpath) $LOAD_PATH.unshift(libpath) else $LOAD_PATH.unshift(path) end end require 'puppettest' require 'puppettest/runnable_test' require 'mocha' +gem 'rspec', '=1.2.2' require 'spec' # load any monkey-patches Dir["#{dir}/monkey_patches/*.rb"].map { |file| require file } Spec::Runner.configure do |config| config.mock_with :mocha # config.prepend_before :all do # setup_mocks_for_rspec # setup() if respond_to? :setup # end # # config.prepend_after :all do # teardown() if respond_to? :teardown # end end # Set the confdir and vardir to gibberish so that tests # have to be correctly mocked. Puppet[:confdir] = "/dev/null" Puppet[:vardir] = "/dev/null" # We need this because the RAL uses 'should' as a method. This # allows us the same behaviour but with a different method name. class Object alias :must :should end