aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins/rspec/lib/spec/extensions
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2009-12-02 17:56:17 +0000
committerFrancis Irving <francis@mysociety.org>2009-12-02 17:56:17 +0000
commit1bbb3f950f8bee92bf8a39e6f18c3278f1bab11d (patch)
tree5d0312d5d00446cd1454a5e1c799cd89d57b10d6 /vendor/plugins/rspec/lib/spec/extensions
parent5f3139b538d1ff58b719a72d7c7cf05a5b6136b5 (diff)
Changing rspec / rspec_on_rails version
Diffstat (limited to 'vendor/plugins/rspec/lib/spec/extensions')
-rw-r--r--vendor/plugins/rspec/lib/spec/extensions/class.rb24
-rw-r--r--vendor/plugins/rspec/lib/spec/extensions/main.rb102
-rw-r--r--vendor/plugins/rspec/lib/spec/extensions/metaclass.rb7
-rwxr-xr-xvendor/plugins/rspec/lib/spec/extensions/object.rb6
4 files changed, 0 insertions, 139 deletions
diff --git a/vendor/plugins/rspec/lib/spec/extensions/class.rb b/vendor/plugins/rspec/lib/spec/extensions/class.rb
deleted file mode 100644
index 30730f87e..000000000
--- a/vendor/plugins/rspec/lib/spec/extensions/class.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-class Class
- # Creates a new subclass of self, with a name "under" our own name.
- # Example:
- #
- # x = Foo::Bar.subclass('Zap'){}
- # x.name # => Foo::Bar::Zap_1
- # x.superclass.name # => Foo::Bar
- def subclass(base_name, &body)
- klass = Class.new(self)
- class_name = "#{base_name}_#{class_count!}"
- instance_eval do
- const_set(class_name, klass)
- end
- klass.instance_eval(&body)
- klass
- end
-
- private
- def class_count!
- @class_count ||= 0
- @class_count += 1
- @class_count
- end
-end \ No newline at end of file
diff --git a/vendor/plugins/rspec/lib/spec/extensions/main.rb b/vendor/plugins/rspec/lib/spec/extensions/main.rb
deleted file mode 100644
index 281cbf879..000000000
--- a/vendor/plugins/rspec/lib/spec/extensions/main.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-module Spec
- module Extensions
- module Main
- # Creates and returns a class that includes the ExampleGroupMethods
- # module. Which ExampleGroup type is created 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 example group
- # type with an options Hash as the last argument:
- #
- # describe "name", :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::Example::ExampleFactory#register for details about how to
- # register special implementations.
- #
- def describe(*args, &block)
- raise ArgumentError if args.empty?
- raise ArgumentError unless block
- args << {} unless Hash === args.last
- args.last[:spec_path] = caller(0)[1]
- Spec::Example::ExampleGroupFactory.create_example_group(*args, &block)
- end
- alias :context :describe
-
- # Creates an example group that can be shared by other example groups
- #
- # == Examples
- #
- # share_examples_for "All Editions" do
- # it "all editions behaviour" ...
- # end
- #
- # describe SmallEdition do
- # it_should_behave_like "All Editions"
- #
- # it "should do small edition stuff" do
- # ...
- # end
- # end
- def share_examples_for(name, &block)
- describe(name, :shared => true, &block)
- end
-
- alias :shared_examples_for :share_examples_for
-
- # Creates a Shared Example Group and assigns it to a constant
- #
- # share_as :AllEditions do
- # it "should do all editions stuff" ...
- # end
- #
- # describe SmallEdition do
- # it_should_behave_like AllEditions
- #
- # it "should do small edition stuff" do
- # ...
- # end
- # end
- #
- # And, for those of you who prefer to use something more like Ruby, you
- # can just include the module directly
- #
- # describe SmallEdition do
- # include AllEditions
- #
- # it "should do small edition stuff" do
- # ...
- # end
- # end
- def share_as(name, &block)
- begin
- Object.const_set(name, share_examples_for(name, &block))
- rescue NameError => e
- raise NameError.new(e.message + "\nThe first argument to share_as must be a legal name for a constant\n")
- end
- end
-
- private
-
- def rspec_options
- $rspec_options ||= begin; \
- parser = ::Spec::Runner::OptionParser.new(STDERR, STDOUT); \
- parser.order!(ARGV); \
- $rspec_options = parser.options; \
- end
- $rspec_options
- end
-
- def init_rspec_options(options)
- $rspec_options = options if $rspec_options.nil?
- end
- end
- end
-end
-
-include Spec::Extensions::Main \ No newline at end of file
diff --git a/vendor/plugins/rspec/lib/spec/extensions/metaclass.rb b/vendor/plugins/rspec/lib/spec/extensions/metaclass.rb
deleted file mode 100644
index acf9febea..000000000
--- a/vendor/plugins/rspec/lib/spec/extensions/metaclass.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Spec
- module MetaClass
- def metaclass
- class << self; self; end
- end
- end
-end \ No newline at end of file
diff --git a/vendor/plugins/rspec/lib/spec/extensions/object.rb b/vendor/plugins/rspec/lib/spec/extensions/object.rb
deleted file mode 100755
index 0b8c26fa2..000000000
--- a/vendor/plugins/rspec/lib/spec/extensions/object.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Object
- def args_and_options(*args)
- options = Hash === args.last ? args.pop : {}
- return args, options
- end
-end