module MIPSUnit::MSpec::DSL

This module adds the describe method to the top-level namespace. The most straightforward way to do this would be to define at the top level; however, doing so would add a describe method to every object in the system. By putting describe in its own DSL module then extending/including it, we limit where the method is added.

The code in this file mimics Myron Martson’s design for RSPec. See stackoverflow.com/questions/12826270/why-use-extend-include-instead-of-simply-defining-method-in-main-object for a more thorough explanation.

Public Instance Methods

describe(name, &block) click to toggle source
# File lib/mipsunit/mspec/dsl.rb, line 24
def describe(name, &block)
  MIPSUnit::MSpec.global.add_group(MIPSUnit::MSpec::TestFactory.describe(name, &block))
end