class RoxClient::TestResult
Attributes
category[R]
duration[R]
key[R]
message[R]
name[R]
tickets[R]
Public Class Methods
new(project, options = {})
click to toggle source
# File lib/rox-client-ruby/test_result.rb, line 6 def initialize project, options = {} @key = options[:key] @name = options[:name] @category = project.category || options[:category] @tags = (wrap(project.tags) + wrap(options[:tags])).compact.collect(&:to_s).uniq @tickets = (wrap(project.tickets) + wrap(options[:tickets])).compact.collect(&:to_s).uniq @grouped = !!options[:grouped] @passed = !!options[:passed] @duration = options[:duration] @message = options[:message] end
Public Instance Methods
grouped?()
click to toggle source
# File lib/rox-client-ruby/test_result.rb, line 26 def grouped? @grouped end
passed?()
click to toggle source
# File lib/rox-client-ruby/test_result.rb, line 22 def passed? @passed end
to_h(options = {})
click to toggle source
# File lib/rox-client-ruby/test_result.rb, line 36 def to_h options = {} { 'k' => @key, 'p' => @passed, 'd' => @duration }.tap do |h| h['m'] = @message if @message cache = options[: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'] = @tags if stale or (first and !@tags.empty?) h['t'] = @tickets if stale or (first and !@tickets.empty?) end end
update(options = {})
click to toggle source
# File lib/rox-client-ruby/test_result.rb, line 30 def update options = {} @passed &&= !!options[:passed] @duration += options[:duration] @message = [ @message, options[:message] ].select{ |m| m }.join("\n\n") if options[:message] end
Private Instance Methods
wrap(a)
click to toggle source
# File lib/rox-client-ruby/test_result.rb, line 57 def wrap a a.kind_of?(Array) ? a : [ a ] end