Class: FlakeySpecCatcher::RerunCapsule

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/flakey_spec_catcher/rerun_capsule.rb

Overview

RerunCapsule class

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(usage: nil, testcase: []) ⇒ RerunCapsule

Returns a new instance of RerunCapsule.



12
13
14
15
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 12

def initialize(usage: nil, testcase: [])
  @usage = initialize_usage(usage)
  @testcase = initialize_testcase(testcase)
end

Instance Attribute Details

#testcaseObject (readonly)

Returns the value of attribute testcase.



10
11
12
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 10

def testcase
  @testcase
end

#usageObject (readonly)

Returns the value of attribute usage.



10
11
12
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 10

def usage
  @usage
end

Instance Method Details

#<=>(other) ⇒ Object



29
30
31
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 29

def <=>(other)
  @testcase <=> other.testcase
end

#==(other) ⇒ Object



33
34
35
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 33

def ==(other)
  usage == other.usage && testcase == other.testcase
end

#default_usage?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 25

def default_usage?
  @usage.nil?
end

#empty?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'lib/flakey_spec_catcher/rerun_capsule.rb', line 17

def empty?
  if testcase.empty?
    true
  else
    false
  end
end