Class: RoxClient::TestResult
- Inherits:
-
Object
- Object
- RoxClient::TestResult
- Defined in:
- lib/rox-client-ruby/test_result.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#tickets ⇒ Object
readonly
Returns the value of attribute tickets.
Instance Method Summary collapse
- #grouped? ⇒ Boolean
-
#initialize(project, options = {}) ⇒ TestResult
constructor
A new instance of TestResult.
- #passed? ⇒ Boolean
- #to_h(options = {}) ⇒ Object
- #update(options = {}) ⇒ Object
Constructor Details
#initialize(project, options = {}) ⇒ TestResult
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rox-client-ruby/test_result.rb', line 6 def initialize project, = {} @key = [:key] @name = [:name] @category = project.category || [:category] = (wrap(project.) + wrap([:tags])).compact.collect(&:to_s).uniq @tickets = (wrap(project.tickets) + wrap([:tickets])).compact.collect(&:to_s).uniq @grouped = !![:grouped] @passed = !![:passed] @duration = [:duration] = [:message] end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def category @category end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def duration @duration end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def key @key end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def name @name end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def end |
#tickets ⇒ Object (readonly)
Returns the value of attribute tickets.
4 5 6 |
# File 'lib/rox-client-ruby/test_result.rb', line 4 def tickets @tickets end |
Instance Method Details
#grouped? ⇒ Boolean
26 27 28 |
# File 'lib/rox-client-ruby/test_result.rb', line 26 def grouped? @grouped end |
#passed? ⇒ Boolean
22 23 24 |
# File 'lib/rox-client-ruby/test_result.rb', line 22 def passed? @passed end |
#to_h(options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rox-client-ruby/test_result.rb', line 36 def to_h = {} { 'k' => @key, 'p' => @passed, 'd' => @duration }.tap do |h| h['m'] = if cache = [:cache] first = !cache || !cache.known?(self) stale = !first && cache.stale?(self) h['n'] = @name if stale or first h['c'] = @category if stale or (first and @category) h['g'] = if stale or (first and !.empty?) h['t'] = @tickets if stale or (first and !@tickets.empty?) end end |
#update(options = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/rox-client-ruby/test_result.rb', line 30 def update = {} @passed &&= !![:passed] @duration += [:duration] = [ , [:message] ].select{ |m| m }.join("\n\n") if [:message] end |