Class: PrettyFace::Formatter::ReportStep

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

Defined Under Namespace

Classes: SnippetExtractor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step) ⇒ ReportStep

Returns a new instance of ReportStep.



190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/pretty_face/formatter/report.rb', line 190

def initialize(step)
  @name = step.name
  @file_colon_line = step.file_colon_line
  unless step.instance_of? Cucumber::Ast::Background
    if step.respond_to? :actual_keyword
      @keyword = step.actual_keyword
    else
      @keyword = step.keyword
    end
    @status = step.status
    @multiline_arg = step.multiline_arg
    @error = step.exception
  end
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def duration
  @duration
end

#errorObject

Returns the value of attribute error.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def error
  @error
end

#file_colon_lineObject

Returns the value of attribute file_colon_line.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def file_colon_line
  @file_colon_line
end

#keywordObject

Returns the value of attribute keyword.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def keyword
  @keyword
end

#multiline_argObject

Returns the value of attribute multiline_arg.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def multiline_arg
  @multiline_arg
end

#nameObject

Returns the value of attribute name.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def name
  @name
end

#statusObject

Returns the value of attribute status.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def status
  @status
end

#tableObject

Returns the value of attribute table.



188
189
190
# File 'lib/pretty_face/formatter/report.rb', line 188

def table
  @table
end

Instance Method Details

#extra_failure_content(file_colon_line) ⇒ Object

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



224
225
226
227
# File 'lib/pretty_face/formatter/report.rb', line 224

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

#failed_with_error?Boolean

Returns:

  • (Boolean)


205
206
207
# File 'lib/pretty_face/formatter/report.rb', line 205

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

#file_with_error(file_colon_line) ⇒ Object



217
218
219
220
221
# File 'lib/pretty_face/formatter/report.rb', line 217

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)


213
214
215
# File 'lib/pretty_face/formatter/report.rb', line 213

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

#has_table?Boolean

Returns:

  • (Boolean)


209
210
211
# File 'lib/pretty_face/formatter/report.rb', line 209

def has_table?
  not table.nil?
end