summaryrefslogtreecommitdiffstats
path: root/test/lib/spec/runner/extensions/kernel.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-08-23 11:52:31 -0500
committerLuke Kanies <luke@madstop.com>2007-08-23 11:52:31 -0500
commit58494cc8566da04711715e54274f472377b1aba0 (patch)
tree66bd610d359f549fc68e9985accf7b4141b7982e /test/lib/spec/runner/extensions/kernel.rb
parentd59315a07a8a01ca65952d8e8fe9d2f1bb84d30e (diff)
downloadpuppet-58494cc8566da04711715e54274f472377b1aba0.tar.gz
puppet-58494cc8566da04711715e54274f472377b1aba0.tar.xz
puppet-58494cc8566da04711715e54274f472377b1aba0.zip
Building a stand-alone spec directory for creating the new spec-based tests.
Diffstat (limited to 'test/lib/spec/runner/extensions/kernel.rb')
-rw-r--r--test/lib/spec/runner/extensions/kernel.rb50
1 files changed, 0 insertions, 50 deletions
diff --git a/test/lib/spec/runner/extensions/kernel.rb b/test/lib/spec/runner/extensions/kernel.rb
deleted file mode 100644
index 75f2c335e..000000000
--- a/test/lib/spec/runner/extensions/kernel.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-module Kernel
- # Creates and registers an instance of a Spec::DSL::Behaviour (or a subclass).
- # The instantiated behaviour class depends on the directory of the file
- # calling this method. For example, Spec::Rails will use different
- # classes for specs living in <tt>spec/models</tt>, <tt>spec/helpers</tt>,
- # <tt>spec/views</tt> and <tt>spec/controllers</tt>.
- #
- # It is also possible to override autodiscovery of the behaviour class
- # with an options Hash as the last argument:
- #
- # describe "name", :behaviour_type => :something_special do ...
- #
- # The reason for using different behaviour classes is to have
- # different matcher methods available from within the <tt>describe</tt>
- # block.
- #
- # See Spec::DSL::BehaviourFactory#add_behaviour_class for details about
- # how to register special Spec::DSL::Behaviour implementations.
- #
- def describe(*args, &block)
- raise ArgumentError if args.empty?
- args << {} unless Hash === args.last
- args.last[:spec_path] = caller(0)[1]
- register_behaviour(Spec::DSL::BehaviourFactory.create(*args, &block))
- end
- alias :context :describe
-
- def respond_to(*names)
- Spec::Matchers::RespondTo.new(*names)
- end
-
-private
-
- def register_behaviour(behaviour)
- if behaviour.shared?
- Spec::DSL::Behaviour.add_shared_behaviour(behaviour)
- else
- behaviour_runner.add_behaviour(behaviour)
- end
- end
-
- def behaviour_runner
- # TODO: Figure out a better way to get this considered "covered" and keep this statement on multiple lines
- unless $behaviour_runner; \
- $behaviour_runner = ::Spec::Runner::OptionParser.new.create_behaviour_runner(ARGV.dup, STDERR, STDOUT, false); \
- at_exit { $behaviour_runner.run(nil, false) }; \
- end
- $behaviour_runner
- end
-end