Class: TestRun::Tests::Minitest::Wrappers::MultipleRoots

Inherits:
Object
  • Object
show all
Defined in:
lib/test_run/tests/minitest/wrappers/multiple_roots.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files, shell) ⇒ MultipleRoots

Returns a new instance of MultipleRoots.



11
12
13
14
# File 'lib/test_run/tests/minitest/wrappers/multiple_roots.rb', line 11

def initialize(files, shell)
  @shell = shell
  @roots = files.map {|f| SingleFile.new(f)}.group_by {|f| f.app_root}.map {|root, _files| SingleRoot.new(_files, shell)}
end

Instance Attribute Details

#rootsObject (readonly)

Returns the value of attribute roots.



9
10
11
# File 'lib/test_run/tests/minitest/wrappers/multiple_roots.rb', line 9

def roots
  @roots
end

#shellObject (readonly)

Returns the value of attribute shell.



9
10
11
# File 'lib/test_run/tests/minitest/wrappers/multiple_roots.rb', line 9

def shell
  @shell
end

Instance Method Details

#should_run?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/test_run/tests/minitest/wrappers/multiple_roots.rb', line 20

def should_run?
  shell.confirm?("Found #{roots.inject(0) {|sum, root| sum + root.files.size }} test files in #{roots.size} apps/engines.  Run them all?")
end

#to_commandObject



16
17
18
# File 'lib/test_run/tests/minitest/wrappers/multiple_roots.rb', line 16

def to_command
  roots.map(&:to_command).join("; cd -; \n\n")
end