Class: Oktest::SpecLeaf

Inherits:
Item
  • Object
show all
Defined in:
lib/oktest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, desc, tag: nil, fixture: nil, location: nil, &block) ⇒ SpecLeaf

Returns a new instance of SpecLeaf.



1156
1157
1158
1159
1160
1161
1162
1163
1164
# File 'lib/oktest.rb', line 1156

def initialize(parent, desc, tag: nil, fixture: nil, location: nil, &block)
  #@parent = parent      # not keep parent node to avoid recursive reference
  @desc  = desc
  @tag   = tag
  @fixture  = fixture
  @location = location   # necessary when raising fixture not found error
  @block = block
  parent.add_child(self) if parent
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



1166
1167
1168
# File 'lib/oktest.rb', line 1166

def block
  @block
end

#descObject (readonly)

Returns the value of attribute desc.



1166
1167
1168
# File 'lib/oktest.rb', line 1166

def desc
  @desc
end

#fixtureObject (readonly)

Returns the value of attribute fixture.



1166
1167
1168
# File 'lib/oktest.rb', line 1166

def fixture
  @fixture
end

#locationObject (readonly)

Returns the value of attribute location.



1166
1167
1168
# File 'lib/oktest.rb', line 1166

def location
  @location
end

#tagObject (readonly)

Returns the value of attribute tag.



1166
1167
1168
# File 'lib/oktest.rb', line 1166

def tag
  @tag
end

Instance Method Details

#-@Object



1195
1196
1197
1198
# File 'lib/oktest.rb', line 1195

def -@
  #; [!bua80] returns self.
  self
end

#_prefixObject



1168
1169
1170
# File 'lib/oktest.rb', line 1168

def _prefix
  '-'
end

#_repr(depth = 0, buf = String.new) ⇒ Object

:nodoc:



1187
1188
1189
1190
1191
1192
1193
# File 'lib/oktest.rb', line 1187

def _repr(depth=0, buf=String.new)       #:nodoc:
  #; [!6nsgy] builds debug string.
  buf << "  " * depth << "- #{@desc}"
  buf << " (tag: #{@tag.inspect})" if @tag
  buf << "\n"
  return buf
end

#accept_visitor(visitor, *args) ⇒ Object



1177
1178
1179
1180
# File 'lib/oktest.rb', line 1177

def accept_visitor(visitor, *args)
  #; [!ya32z] invokes 'visit_spec()' method of visitor and returns result of it.
  return visitor.visit_spec(self, *args)
end

#run_block_in_context_object(context, *args) ⇒ Object



1172
1173
1174
1175
# File 'lib/oktest.rb', line 1172

def run_block_in_context_object(context, *args)
  #; [!tssim] run spec block in text object.
  context.instance_exec(*args, &@block)
end


1182
1183
1184
1185
# File 'lib/oktest.rb', line 1182

def unlink_parent()
  #; [!e9sv9] do nothing.
  nil
end