Class: Matest::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/matest.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(printer: SpecPrinter.new) ⇒ Runner

Returns a new instance of Runner.



12
13
14
15
16
# File 'lib/matest.rb', line 12

def initialize(printer: SpecPrinter.new)
  @example_groups = []
  @info           = {}
  @printer        = printer
end

Instance Attribute Details

#example_groupsObject (readonly)

Returns the value of attribute example_groups.



8
9
10
# File 'lib/matest.rb', line 8

def example_groups
  @example_groups
end

#infoObject (readonly)

Returns the value of attribute info.



9
10
11
# File 'lib/matest.rb', line 9

def info
  @info
end

#printerObject (readonly)

Returns the value of attribute printer.



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

def printer
  @printer
end

Class Method Details

.runnerObject



18
19
20
# File 'lib/matest.rb', line 18

def self.runner
  @runner ||= new
end

Instance Method Details

#<<(example_group) ⇒ Object



22
23
24
# File 'lib/matest.rb', line 22

def <<(example_group)
  example_groups << example_group
end

#execute!Object



30
31
32
33
34
35
# File 'lib/matest.rb', line 30

def execute!
  example_groups.each do |current_group|
    current_group.execute!
  end
  printer.print(self)
end

#load_file(file) ⇒ Object



26
27
28
# File 'lib/matest.rb', line 26

def load_file(file)
  load(file)
end