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.



1130
1131
1132
1133
1134
1135
1136
1137
1138
# File 'lib/oktest.rb', line 1130

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.



1140
1141
1142
# File 'lib/oktest.rb', line 1140

def block
  @block
end

#descObject (readonly)

Returns the value of attribute desc.



1140
1141
1142
# File 'lib/oktest.rb', line 1140

def desc
  @desc
end

#fixtureObject (readonly)

Returns the value of attribute fixture.



1140
1141
1142
# File 'lib/oktest.rb', line 1140

def fixture
  @fixture
end

#locationObject (readonly)

Returns the value of attribute location.



1140
1141
1142
# File 'lib/oktest.rb', line 1140

def location
  @location
end

#tagObject (readonly)

Returns the value of attribute tag.



1140
1141
1142
# File 'lib/oktest.rb', line 1140

def tag
  @tag
end

Instance Method Details

#-@Object



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

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

#_prefixObject



1142
1143
1144
# File 'lib/oktest.rb', line 1142

def _prefix
  '-'
end

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

:nodoc:



1161
1162
1163
1164
1165
1166
1167
# File 'lib/oktest.rb', line 1161

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



1151
1152
1153
1154
# File 'lib/oktest.rb', line 1151

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



1146
1147
1148
1149
# File 'lib/oktest.rb', line 1146

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


1156
1157
1158
1159
# File 'lib/oktest.rb', line 1156

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