Module: Spectroscope::DSL

Defined in:
lib/spectroscope.rb

Overview

The DSL module extends the toplevel.

Instance Method Summary collapse

Instance Method Details

#describe(topic, *tags, &block) ⇒ Object

Define an example group.


17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/spectroscope.rb', line 17

def describe(topic, *tags, &block)
  settings = {}

  if Class === topic
    settings[:subject] = topic
    settings[:label]   = topic.name
  else
    settings[:label]   = topic
  end

  $TEST_SUITE << Spectroscope::Context.new(settings, &block)
end

#shared_examples_for(label, &block) ⇒ Object


33
34
35
# File 'lib/spectroscope.rb', line 33

def shared_examples_for(label, &block)
  Spectroscope.shared_examples[label] = block
end