Class: Konacha::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/konacha/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(row) ⇒ Example

Returns a new instance of Example.



110
111
112
# File 'lib/konacha/runner.rb', line 110

def initialize(row)
  @row = row
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'lib/konacha/runner.rb', line 122

def failed?
  !(@row['passed'] || @row['pending'])
end

#failure_messageObject



126
127
128
129
130
131
132
133
134
135
136
# File 'lib/konacha/runner.rb', line 126

def failure_message
  if failed?
    msg = []
    msg << "  Failed: #{@row['name']}"
    msg << "    #{@row['message']}"
    msg << "    in #{@row['trace']['fileName']}:#{@row['trace']['lineNumber']}" if @row['trace']
    msg.join("\n").red
  elsif pending?
    "  Pending: #{@row['name']}".yellow
  end
end

#passed?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/konacha/runner.rb', line 114

def passed?
  @row['passed']
end

#pending?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/konacha/runner.rb', line 118

def pending?
  @row['pending']
end