Class: Crew::Task::Test::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/crew/task/test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#context_nameObject

Returns the value of attribute context_name

Returns:

  • (Object)

    the current value of context_name



10
11
12
# File 'lib/crew/task/test.rb', line 10

def context_name
  @context_name
end

#extrasObject

Returns the value of attribute extras

Returns:

  • (Object)

    the current value of extras



10
11
12
# File 'lib/crew/task/test.rb', line 10

def extras
  @extras
end

#indexObject

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



10
11
12
# File 'lib/crew/task/test.rb', line 10

def index
  @index
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



10
11
12
# File 'lib/crew/task/test.rb', line 10

def status
  @status
end

#task_nameObject

Returns the value of attribute task_name

Returns:

  • (Object)

    the current value of task_name



10
11
12
# File 'lib/crew/task/test.rb', line 10

def task_name
  @task_name
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/crew/task/test.rb', line 19

def failed?
  status == 'fail'
end

#missing?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/crew/task/test.rb', line 11

def missing?
  status == 'missing'
end

#passed?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/crew/task/test.rb', line 15

def passed?
  status == 'pass'
end

#skipped?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/crew/task/test.rb', line 23

def skipped?
  status == 'skip'
end

#to_sObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/crew/task/test.rb', line 27

def to_s
  out = "#{task_name}##{index} (#{context_name}) = #{status}"
  if extras['start_time'] && extras['end_time']
    out << "\nRan in #{extras['end_time'] - extras['start_time']}"
  end
  if extras['exception']
    e = extras['exception']
    out << "\n#{e['message']} (#{e['class']}): #{e['backtrace'].join("\n  ")}"
  end
  out
end