Module: Spec::Runner::ContextEval::ModuleMethods

Defined in:
lib/spec/runner/context_eval.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (protected)



43
44
45
46
47
48
# File 'lib/spec/runner/context_eval.rb', line 43

def method_missing(method_name, *args)
  if context_superclass.respond_to?(method_name)
    return execution_context_class.send(method_name, *args)
  end
  super
end

Instance Method Details

#context_setup(&block) ⇒ Object



15
16
17
# File 'lib/spec/runner/context_eval.rb', line 15

def context_setup(&block)
  context_setup_parts << block
end

#context_teardown(&block) ⇒ Object



19
20
21
# File 'lib/spec/runner/context_eval.rb', line 19

def context_teardown(&block)
  context_teardown_parts << block
end

#include(mod) ⇒ Object



10
11
12
13
# File 'lib/spec/runner/context_eval.rb', line 10

def include(mod)
  context_modules << mod
  mod.send :included, self
end

#inherit(klass) ⇒ Object



5
6
7
8
# File 'lib/spec/runner/context_eval.rb', line 5

def inherit(klass)
  @context_superclass = klass
  derive_execution_context_class_from_context_superclass
end

#methodsObject



35
36
37
38
39
# File 'lib/spec/runner/context_eval.rb', line 35

def methods
  my_methods = super
  my_methods |= context_superclass.methods
  my_methods
end

#setup(&block) ⇒ Object



23
24
25
# File 'lib/spec/runner/context_eval.rb', line 23

def setup(&block)
  setup_parts << block
end

#specify(spec_name = :__generate_description, opts = {}, &block) ⇒ Object



31
32
33
# File 'lib/spec/runner/context_eval.rb', line 31

def specify(spec_name=:__generate_description, opts={}, &block)
  specifications << Specification.new(spec_name, opts, &block)
end

#teardown(&block) ⇒ Object



27
28
29
# File 'lib/spec/runner/context_eval.rb', line 27

def teardown(&block)
  teardown_parts << block
end