Module: Spec::DSL::Main

Module | Spec::DSL::Main
In: | lib/spec/dsl/main.rb

### Methods

context describe share_as share_examples_for shared_examples_for

### Included Modules

Spec::Example::ArgsAndOptions

### Public Instance methods

context(*args, &block)

Alias for describe

describe(*args, &block)

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

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 example group classes is to have different matcher methods available from within the `describe` block.

See Spec::Example::ExampleGroupFactory#register for details about how to register special implementations.

share_as(name, &block)

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

share_examples_for(*args, &block)

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

shared_examples_for(*args, &block)

Alias for share_examples_for

[Validate]