class FlakeySpecCatcher::RerunCapsule

RerunCapsule class

Contains one file or test case to re-run, as well as its associated RSpec usage.

Attributes

testcase[R]
usage[R]

Public Class Methods

new(usage: nil, testcase: []) click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 12
def initialize(usage: nil, testcase: [])
  @usage = initialize_usage(usage)
  @testcase = initialize_testcase(testcase)
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 29
def <=>(other)
  @testcase <=> other.testcase
end
==(other) click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 33
def ==(other)
  usage == other.usage && testcase == other.testcase
end
default_usage?() click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 25
def default_usage?
  @usage.nil?
end
empty?() click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 17
def empty?
  if testcase.empty?
    true
  else
    false
  end
end

Private Instance Methods

initialize_testcase(testcase) click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 47
def initialize_testcase(testcase)
  if testcase.nil? || testcase.empty?
    []
  elsif testcase.is_a?(Array)
    testcase
  else
    raise "Error: expected array for testcase not #{testcase.class}"
  end
end
initialize_usage(usage) click to toggle source
# File lib/flakey_spec_catcher/rerun_capsule.rb, line 39
def initialize_usage(usage)
  if usage.nil? || usage.empty?
    nil
  else
    usage
  end
end