4 # Creates and returns a class that includes the ExampleGroupMethods
5 # module. The ExampleGroup sub-class depends on the directory of the file
6 # calling this method. For example, Spec::Rails will use different
7 # classes for specs living in <tt>spec/models</tt>,
8 # <tt>spec/helpers</tt>, <tt>spec/views</tt> and
9 # <tt>spec/controllers</tt>.
11 # It is also possible to override autodiscovery of the behaviour class
12 # with an options Hash as the last argument:
14 # describe "name", :behaviour_type => :something_special do ...
16 # The reason for using different behaviour classes is to have different
17 # matcher methods available from within the <tt>describe</tt> block.
19 # See Spec::Example::ExampleFactory#register for details about how to
20 # register special implementations.
22 def describe(*args, &block)
23 raise ArgumentError if args.empty?
24 raise ArgumentError unless block
25 args << {} unless Hash === args.last
26 args.last[:spec_path] = caller(0)[1]
27 Spec::Example::ExampleGroupFactory.create_example_group(*args, &block)
29 alias :context :describe
34 $rspec_options ||= begin; \
35 parser = ::Spec::Runner::OptionParser.new(STDERR, STDOUT); \
36 parser.order!(ARGV); \
37 $rspec_options = parser.options; \
42 def init_rspec_options(options)
43 $rspec_options = options if $rspec_options.nil?
49 include Spec::Extensions::Main