Class: Matest::Runner
- Inherits:
-
Object
- Object
- Matest::Runner
- Defined in:
- lib/matest/runner.rb
Instance Attribute Summary collapse
-
#example_groups ⇒ Object
readonly
Returns the value of attribute example_groups.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#printer ⇒ Object
readonly
Returns the value of attribute printer.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(example_group) ⇒ Object
- #execute! ⇒ Object
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #load_file(file) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 |
# File 'lib/matest/runner.rb', line 7 def initialize(={}) @example_groups = [] @info = {} @printer = [:printer] || SpecPrinter.new end |
Instance Attribute Details
#example_groups ⇒ Object (readonly)
Returns the value of attribute example_groups.
3 4 5 |
# File 'lib/matest/runner.rb', line 3 def example_groups @example_groups end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
4 5 6 |
# File 'lib/matest/runner.rb', line 4 def info @info end |
#printer ⇒ Object (readonly)
Returns the value of attribute printer.
5 6 7 |
# File 'lib/matest/runner.rb', line 5 def printer @printer end |
Class Method Details
.runner ⇒ Object
13 14 15 |
# File 'lib/matest/runner.rb', line 13 def self.runner @runner ||= new end |
Instance Method Details
#<<(example_group) ⇒ Object
17 18 19 20 |
# File 'lib/matest/runner.rb', line 17 def <<(example_group) example_group.printer = printer example_groups << example_group end |
#execute! ⇒ Object
31 32 33 34 35 36 |
# File 'lib/matest/runner.rb', line 31 def execute! example_groups.each do |current_group| current_group.execute! end printer.(self) end |
#load_file(file) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/matest/runner.rb', line 22 def load_file(file) location = file.split(":") if location.count == 1 require(file) else require_spec(*location) end end |