Class: UglyFace::Formatter::ReportStep

Inherits:
Object
  • Object
show all
Defined in:
lib/ugly_face/formatter/report.rb

Defined Under Namespace

Classes: SnippetExtractor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step, ast_step = nil) ⇒ ReportStep

Returns a new instance of ReportStep.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/ugly_face/formatter/report.rb', line 197

def initialize(step, ast_step=nil)
  if ast_step
    @name = ast_step.name
    @keyword = ast_step.keyword
    @status = ast_step.status
    @error = ast_step.exception
  else
    @name = step.name
    unless step.instance_of? Cucumber::Formatter::LegacyApi::Ast::Background
      @keyword = step.keyword
      @status = step.status
      @multiline_arg = step.multiline_arg unless step.multiline_arg.instance_of? Cucumber::Core::Ast::EmptyMultilineArgument
      @error = step.exception
    end
  end
  @file_colon_line = step.file_colon_line
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def duration
  @duration
end

#errorObject

Returns the value of attribute error.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def error
  @error
end

#file_colon_lineObject

Returns the value of attribute file_colon_line.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def file_colon_line
  @file_colon_line
end

#keywordObject

Returns the value of attribute keyword.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def keyword
  @keyword
end

#multiline_argObject

Returns the value of attribute multiline_arg.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def multiline_arg
  @multiline_arg
end

#nameObject

Returns the value of attribute name.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def name
  @name
end

#statusObject

Returns the value of attribute status.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def status
  @status
end

#tableObject

Returns the value of attribute table.



195
196
197
# File 'lib/ugly_face/formatter/report.rb', line 195

def table
  @table
end

Instance Method Details

#extra_failure_content(file_colon_line) ⇒ Object

from cucumber ===================



234
235
236
237
# File 'lib/ugly_face/formatter/report.rb', line 234

def extra_failure_content(file_colon_line)
  @snippet_extractor ||= SnippetExtractor.new
  @snippet_extractor.snippet(file_colon_line)
end

#failed_with_error?Boolean

Returns:

  • (Boolean)


215
216
217
# File 'lib/ugly_face/formatter/report.rb', line 215

def failed_with_error?
  status == :failed && !error.nil?
end

#file_with_error(file_colon_line) ⇒ Object



227
228
229
230
231
# File 'lib/ugly_face/formatter/report.rb', line 227

def file_with_error(file_colon_line)
  @snippet_extractor ||= SnippetExtractor.new
  file, line = @snippet_extractor.file_name_and_line(file_colon_line)
  file
end

#has_multiline_arg?Boolean

Returns:

  • (Boolean)


223
224
225
# File 'lib/ugly_face/formatter/report.rb', line 223

def has_multiline_arg?
  !multiline_arg.nil? && !has_table?
end

#has_table?Boolean

Returns:

  • (Boolean)


219
220
221
# File 'lib/ugly_face/formatter/report.rb', line 219

def has_table?
  not table.nil?
end