Class: DTest::Global::Manager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/dtest/global.rb

Overview

class Harness

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Singleton

#remove_instance_var

Constructor Details

#initializeManager

Returns a new instance of Manager.



87
88
89
# File 'lib/dtest/global.rb', line 87

def initialize
  clear
end

Instance Attribute Details

#definedObject

Returns the value of attribute defined.



85
86
87
# File 'lib/dtest/global.rb', line 85

def defined
  @defined
end

#harnessObject

Returns the value of attribute harness.



84
85
86
# File 'lib/dtest/global.rb', line 84

def harness
  @harness
end

Instance Method Details

#after(option = {}, &block) ⇒ Object



111
112
113
114
115
# File 'lib/dtest/global.rb', line 111

def after(option = {}, &block)
  b = Block.new("after", option, &block)
  b.parent = 'Global'
  @harness.after << b
end

#before(option = {}, &block) ⇒ Object



105
106
107
108
109
# File 'lib/dtest/global.rb', line 105

def before(option = {}, &block)
  b = Block.new("before", option, &block)
  b.parent = 'Global'
  @harness.before << b
end

#clearObject



91
92
93
94
95
# File 'lib/dtest/global.rb', line 91

def clear
  remove_instance_var
  @harness = Harness.new
  @defined = false
end

#include_context(name) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/dtest/global.rb', line 97

def include_context(name)
  if DTest::SharedContext::Manager::instance.has_key?(name)
    @harness.shared_contexts << name unless @harness.shared_contexts.include?(name)
  else
    raise "#{name} context is not defined"
  end
end