Class: GreenPepper::HtmlTableExecutionResults
Instance Attribute Summary collapse
#errors, #failures, #ignored, #successes
Instance Method Summary
collapse
#add_error, #add_failure, #add_ignore, #add_success, get_all_results
Constructor Details
Returns a new instance of HtmlTableExecutionResults.
83
84
85
86
87
|
# File 'lib/greenpepper/example/executionresults.rb', line 83
def initialize
super
@results = Array.new
@size = 0
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
80
81
82
|
# File 'lib/greenpepper/example/executionresults.rb', line 80
def context
@context
end
|
#size ⇒ Object
Returns the value of attribute size.
81
82
83
|
# File 'lib/greenpepper/example/executionresults.rb', line 81
def size
@size
end
|
Instance Method Details
#add(row, column, result) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/greenpepper/example/executionresults.rb', line 89
def add(row, column, result)
(row - (@results.size - 1)).times{ @results << []}
(column - (@results[row].size - 1)).times{ @results[row] << nil}
result.row = row
result.column = column
@results[row][column] = result
@size += 1
update_stats result
result
end
|
#at(row, column) ⇒ Object
134
135
136
137
|
# File 'lib/greenpepper/example/executionresults.rb', line 134
def at(row, column)
return @results[row][column] unless check_index(row, column) == false
nil
end
|
#delete_at(row, column) ⇒ Object
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/greenpepper/example/executionresults.rb', line 102
def delete_at(row, column)
result = @results[row][column] unless check_index(row, column) == false
return nil if result == nil
unless result.silent
@successes -= 1 if result.success?
@failures -= 1 if result.failure?
@errors -= 1 if result.error?
@ignored -= 1 if result.ignored?
end
@results[row][column] = nil
@size -= 1
result
end
|
#each ⇒ Object
118
119
120
121
122
123
124
|
# File 'lib/greenpepper/example/executionresults.rb', line 118
def each
@results.each{ |row|
row.each{ |result|
yield result unless result == nil
}
}
end
|
#each_with_index_and_nil ⇒ Object
126
127
128
129
130
131
132
|
# File 'lib/greenpepper/example/executionresults.rb', line 126
def each_with_index_and_nil
@results.each_with_index{ |row, row_idx|
row.each_with_index{ |cell, cell_idx|
yield cell, row_idx, cell_idx
}
}
end
|
#to_s ⇒ Object
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/greenpepper/example/executionresults.rb', line 139
def to_s
s = ""
@results.each{|row|
s << "|"
row.each{|result|
s << sprintf("%25s |", result.class.to_s)
}
s << "\n"
}
s[-1] = ""
s
end
|