Module | Kernel
In: | lib/spec/runner/extensions/kernel.rb

### Methods

context describe respond_to

### Public Instance methods

context(*args, &block)

Alias for describe

describe(*args, &block)

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 `spec/models`, `spec/helpers`, `spec/views` and `spec/controllers`.

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 `describe` block.

See Spec::DSL::BehaviourFactory#add_behaviour_class for details about how to register special Spec::DSL::Behaviour implementations.

[Source]

        # File lib/spec/runner/extensions/kernel.rb, line 20
    20:   def describe(*args, &block)
    21:     raise ArgumentError if args.empty?
    22:     args << {} unless Hash === args.last
    23:     args.last[:spec_path] = caller(0)[1]
    24:     register_behaviour(Spec::DSL::BehaviourFactory.create(*args, &block))
    25:   end

respond_to(*names)

[Source]

        # File lib/spec/runner/extensions/kernel.rb, line 28
    28:   def respond_to(*names)
    29:     Spec::Matchers::RespondTo.new(*names)
    30:   end

[Validate]