Class: Siesta::TestSuite

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

Defined Under Namespace

Classes: Group, Item

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ TestSuite

Returns a new instance of TestSuite.



38
39
40
# File 'lib/siesta/test_suite.rb', line 38

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



36
37
38
# File 'lib/siesta/test_suite.rb', line 36

def path
  @path
end

Instance Method Details

#groupsObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/siesta/test_suite.rb', line 42

def groups
  return @groups if @groups

  @groups = Dir.glob(File.join(path, '**', '*')).inject([]) do |c, f|
    c << Group.new(:path => f, :suite => self) if has_tests?(f)

    c
  end
  @groups << Group.new(:path => path, :suite => self) if has_tests?(path)

  @groups
end

#has_tests?(path) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/siesta/test_suite.rb', line 55

def has_tests?(path)
  File.directory?(path) && !Dir[File.join(path, '*.t.js')].empty?
end