summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-12 23:00:52 -0600
committerLuke Kanies <luke@madstop.com>2008-02-12 23:00:52 -0600
commitbe58bb5c4bc19e59685e0a8953eaf2d3b7844110 (patch)
tree6a2dd1fc88f97f4a76cd19d2459eb88408c877bf /spec
parent11ef70aa357a081fd14158e70acc8d943b5caffa (diff)
parent98dbfa2865ad270d5fd9821c6518f6f30ce9aec4 (diff)
Merge branch '0.24.x'
Diffstat (limited to 'spec')
-rw-r--r--spec/Rakefile12
-rw-r--r--spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb30
-rw-r--r--spec/spec.opts4
-rw-r--r--spec/spec_helper.rb22
-rwxr-xr-xspec/unit/indirector/rest.rb2
-rwxr-xr-xspec/unit/parser/ast/definition.rb8
-rwxr-xr-xspec/unit/parser/lexer.rb4
7 files changed, 48 insertions, 34 deletions
diff --git a/spec/Rakefile b/spec/Rakefile
index 8b45eff89..e2996f64f 100644
--- a/spec/Rakefile
+++ b/spec/Rakefile
@@ -7,10 +7,12 @@ puppetlibdir = File.join(basedir, "../lib")
puppettestlibdir = File.join(basedir, "../test/lib")
speclibdir = File.join(basedir, "lib")
-desc "Run all spec unit tests"
-Spec::Rake::SpecTask.new('unit') do |t|
- t.spec_files = FileList['unit/**/*.rb', 'integration/**/*.rb']
- t.libs = [puppetlibdir, puppettestlibdir, speclibdir]
+libs = [puppetlibdir, puppettestlibdir, speclibdir]
+desc "Run all specs"
+Spec::Rake::SpecTask.new('all') do |t|
+ t.spec_files = FileList['integration/**/*.rb', 'unit/**/*.rb']
+ t.libs = libs
+ t.spec_opts = ['--options', 'spec.opts']
end
-task :default => [:unit]
+task :default => [:all]
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 941baa8de..e2f3d4728 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
@@ -10,22 +10,34 @@ require 'puppettest/runnable_test'
module Spec
module Runner
- class BehaviourRunner
- def run_behaviours
- @behaviours.each do |behaviour|
- # LAK:NOTE: this 'runnable' test is Puppet-specific.
- next unless behaviour.runnable?
- behaviour.run(@options.reporter, @options.dry_run, @options.reverse, @options.timeout)
+ class ExampleGroupRunner
+ def run
+ prepare
+ success = true
+ example_groups.each do |example_group|
+ next unless example_group.runnable?
+ success = success & example_group.run
end
+ return success
+ ensure
+ finish
end
end
end
end
module Spec
- module DSL
- class EvalModule < Module
- include PuppetTest::RunnableTest
+ 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.opts b/spec/spec.opts
index 2cac5f260..2f9bf0d0a 100644
--- a/spec/spec.opts
+++ b/spec/spec.opts
@@ -1,5 +1,3 @@
--colour
---format
-s
--loadby
-mtime \ No newline at end of file
+mtime
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 3aa3b0202..db14b47cb 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -5,7 +5,7 @@ $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/**"].map do |path|
+Dir["#{dir}/../vendor/gems/**"].each do |path|
libpath = File.join(path, "lib")
if File.directory?(libpath)
$LOAD_PATH.unshift(libpath)
@@ -19,16 +19,18 @@ require 'puppettest/runnable_test'
require 'mocha'
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 :each do
- setup() if respond_to? :setup
- end
- config.prepend_after :each do
- teardown() if respond_to? :teardown
- end
+# 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
-
-# load any monkey-patches
-Dir["#{dir}/monkey_patches/*.rb"].map { |file| require file }
diff --git a/spec/unit/indirector/rest.rb b/spec/unit/indirector/rest.rb
index cf29577b9..3c4716dc8 100755
--- a/spec/unit/indirector/rest.rb
+++ b/spec/unit/indirector/rest.rb
@@ -13,7 +13,7 @@ describe Puppet::Indirector::REST do
@rest_class = Class.new(Puppet::Indirector::REST) do
def self.to_s
- "Testing"
+ "This::Is::A::Test::Class"
end
end
diff --git a/spec/unit/parser/ast/definition.rb b/spec/unit/parser/ast/definition.rb
index f236e23b7..a58e4d00e 100755
--- a/spec/unit/parser/ast/definition.rb
+++ b/spec/unit/parser/ast/definition.rb
@@ -45,7 +45,7 @@ describe Puppet::Parser::AST::Definition, "when evaluating" do
#
# it "should evaluate the associated code with the new scope"
- def test_initialize
+ def old_test_initialize
parser = mkparser
# Create a new definition
@@ -67,7 +67,7 @@ describe Puppet::Parser::AST::Definition, "when evaluating" do
end
- def test_evaluate
+ def oldtest_evaluate
parser = mkparser
config = mkcompiler
config.send(:evaluate_main)
@@ -135,7 +135,7 @@ describe Puppet::Parser::AST::Definition, "when evaluating" do
end
# #539 - definitions should support both names and titles
- def test_names_and_titles
+ def oldtest_names_and_titles
parser = mkparser
scope = mkscope :parser => parser
@@ -186,7 +186,7 @@ describe Puppet::Parser::AST::Definition, "when evaluating" do
# Testing the root cause of #615. We should be using the fqname for the type, instead
# of just the short name.
- def test_fully_qualified_types
+ def oldtest_fully_qualified_types
parser = mkparser
klass = parser.newclass("one::two")
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb
index cddbef1ed..9972f7268 100755
--- a/spec/unit/parser/lexer.rb
+++ b/spec/unit/parser/lexer.rb
@@ -11,11 +11,11 @@ describe Puppet::Parser::Lexer::Token do
[:regex, :name, :string, :skip, :incr_line, :skip_text].each do |param|
it "should have a #{param.to_s} reader" do
- @token.should respond_to?(param)
+ @token.should be_respond_to(param)
end
it "should have a #{param.to_s} writer" do
- @token.should respond_to?(param.to_s + "=")
+ @token.should be_respond_to(param.to_s + "=")
end
end
end