Class: CemAcpt::Bolt::Tests::TestResults
- Inherits:
-
Object
- Object
- CemAcpt::Bolt::Tests::TestResults
show all
- Defined in:
- lib/cem_acpt/bolt/tests.rb
Overview
Contains the results of running a Bolt task test
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(test_name, results = []) ⇒ TestResults
Returns a new instance of TestResults.
183
184
185
186
|
# File 'lib/cem_acpt/bolt/tests.rb', line 183
def initialize(test_name, results = [])
@test_name = test_name
@results = results
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **kwargs, &block) ⇒ Object
216
217
218
219
220
221
222
|
# File 'lib/cem_acpt/bolt/tests.rb', line 216
def method_missing(method_name, *args, **kwargs, &block)
if @results.respond_to?(method_name)
@results.send(method_name, *args, **kwargs, &block)
else
super
end
end
|
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
181
182
183
|
# File 'lib/cem_acpt/bolt/tests.rb', line 181
def results
@results
end
|
#test_name ⇒ Object
Returns the value of attribute test_name.
181
182
183
|
# File 'lib/cem_acpt/bolt/tests.rb', line 181
def test_name
@test_name
end
|
Instance Method Details
#action ⇒ Object
196
197
198
|
# File 'lib/cem_acpt/bolt/tests.rb', line 196
def action
@action ||= @results.empty? ? 'unknown' : @results.first.action
end
|
#inspect ⇒ Object
228
229
230
|
# File 'lib/cem_acpt/bolt/tests.rb', line 228
def inspect
"#<#{self.class}:#{object_id.to_s(16)} with #{results.count} result(s)>"
end
|
#object ⇒ Object
204
205
206
|
# File 'lib/cem_acpt/bolt/tests.rb', line 204
def object
@object ||= @results.empty? ? 'unknown' : @results.first.object
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
224
225
226
|
# File 'lib/cem_acpt/bolt/tests.rb', line 224
def respond_to_missing?(method_name, include_private = false)
@results.respond_to?(method_name, include_private) || super
end
|
#status ⇒ Object
192
193
194
|
# File 'lib/cem_acpt/bolt/tests.rb', line 192
def status
@status ||= success? ? 'success' : 'failure'
end
|
#success? ⇒ Boolean
188
189
190
|
# File 'lib/cem_acpt/bolt/tests.rb', line 188
def success?
@results.all? { |r| r.success? }
end
|
#target ⇒ Object
200
201
202
|
# File 'lib/cem_acpt/bolt/tests.rb', line 200
def target
@target ||= @results.empty? ? 'unknown' : @results.first.target
end
|
#to_h ⇒ Object
208
209
210
211
212
213
214
|
# File 'lib/cem_acpt/bolt/tests.rb', line 208
def to_h
{
test_name: test_name,
success: success?,
results: @results.map(&:to_h),
}
end
|