Class: Assert::Suite::ContextInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/assert/suite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, called_from = nil, first_caller = nil) ⇒ ContextInfo

Returns a new instance of ContextInfo.



140
141
142
143
144
# File 'lib/assert/suite.rb', line 140

def initialize(klass, called_from = nil, first_caller = nil)
  @called_from = called_from || first_caller
  @klass = klass
  @file = @called_from.gsub(/\:[0-9]+.*$/, '') if @called_from
end

Instance Attribute Details

#called_fromObject (readonly)

Returns the value of attribute called_from.



138
139
140
# File 'lib/assert/suite.rb', line 138

def called_from
  @called_from
end

#fileObject (readonly)

Returns the value of attribute file.



138
139
140
# File 'lib/assert/suite.rb', line 138

def file
  @file
end

#klassObject (readonly)

Returns the value of attribute klass.



138
139
140
# File 'lib/assert/suite.rb', line 138

def klass
  @klass
end

Instance Method Details

#test_name(name) ⇒ Object



146
147
148
# File 'lib/assert/suite.rb', line 146

def test_name(name)
  [klass.description.to_s, name.to_s].compact.reject(&:empty?).join(' ')
end