Class: PryTest::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-test/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formatter, options = {}) ⇒ Runner



18
19
20
21
# File 'lib/pry-test/runner.rb', line 18

def initialize(formatter, options={})
  @formatter = formatter
  @options = options
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



16
17
18
# File 'lib/pry-test/runner.rb', line 16

def duration
  @duration
end

#failedObject (readonly)

Returns the value of attribute failed.



16
17
18
# File 'lib/pry-test/runner.rb', line 16

def failed
  @failed
end

#formatterObject (readonly)

Returns the value of attribute formatter.



16
17
18
# File 'lib/pry-test/runner.rb', line 16

def formatter
  @formatter
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/pry-test/runner.rb', line 16

def options
  @options
end

#passedObject (readonly)

Returns the value of attribute passed.



16
17
18
# File 'lib/pry-test/runner.rb', line 16

def passed
  @passed
end

Class Method Details

.terminateObject



7
8
9
# File 'lib/pry-test/runner.rb', line 7

def terminate
  @terminate = true
end

.terminate?Boolean



11
12
13
# File 'lib/pry-test/runner.rb', line 11

def terminate?
  !!@terminate
end

Instance Method Details

#failed_testsObject



38
39
40
# File 'lib/pry-test/runner.rb', line 38

def failed_tests
  tests.select{ |test| test.invoked? && !test.passed? }
end

#passed_testsObject



46
47
48
# File 'lib/pry-test/runner.rb', line 46

def passed_tests
  tests.select{ |test| test.invoked? && test.passed? }
end

#runObject



23
24
25
26
27
28
# File 'lib/pry-test/runner.rb', line 23

def run
  formatter.before_suite(test_classes)
  run_test_classes
  formatter.after_suite(test_classes)
  failed
end

#test_classesObject



30
31
32
# File 'lib/pry-test/runner.rb', line 30

def test_classes
  @test_classes ||= PryTest::Test.subclasses.shuffle
end

#testsObject



34
35
36
# File 'lib/pry-test/runner.rb', line 34

def tests
  @tests ||= test_classes.map{ |klass| klass.tests }.flatten
end