Class: Probatio::Group
- Includes:
- Helpers
- Defined in:
- lib/probatio.rb,
lib/probatio/helpers.rb
Constant Summary
Constants inherited from Section
Section::ATTRS, Section::METHS
Instance Attribute Summary
Attributes inherited from Node
#block, #children, #opts, #parent, #path
Instance Method Summary collapse
- #group(*names, &block) ⇒ Object
- #section(name, opts = {}, &block) ⇒ Object
- #test(name, opts = {}, &block) ⇒ Object
Methods included from Helpers
#beep, #jruby?, #time, #windows?
Methods inherited from Section
#add_block, #add_file, #add_section, #after, #afters, #all_tests, #around, #arounds, #before, #befores, #context, #initialize, #method_missing, #path=, #run, #setup, #skip?, #teardown
Methods included from Waiters
Methods inherited from Node
#array_name, #depth, #filename, #full_name, #groups, #head, #initialize, #last_line, #line, #location, #map, #name, #path_and_line, #pending?, #root, #skip?, #test?, #to_s, #trail, #type
Constructor Details
This class inherits a constructor from Probatio::Section
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Probatio::Section
Instance Method Details
#group(*names, &block) ⇒ Object
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/probatio.rb', line 581 def group(*names, &block) opts = names.last.is_a?(Hash) ? names.pop : {} names = names .collect { |s| s.to_s.split(/\s*(?:\||;|<|>)\s*/) } .flatten(1) last_name = names.last names.inject(self) do |g, name| gg = g.groups.find { |e| e.name == name } if gg gg.path = @path else gg = Probatio::Group.new(g, @path, name, opts, block) g.children << gg end gg.add_block(block) if name == last_name gg end end |