Class: Sevgi::Test::Suite Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sevgi/showcase/minitest/suite.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Showcase script suite collection.

Constant Summary collapse

NON_VALIDS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Suite names that are expected to be invalid examples.

["gotcha"].freeze

Instance Method Summary collapse

Constructor Details

#initialize(rootdir) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a suite from a showcase root directory.

Parameters:

  • rootdir (String)

    showcase root directory



13
14
15
# File 'lib/sevgi/showcase/minitest/suite.rb', line 13

def initialize(rootdir)
  @scripts = load(rootdir)
end

Instance Method Details

#[](suite) ⇒ Array<Sevgi::Test::Script>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns scripts belonging to a suite.

Parameters:

  • suite (String, Symbol)

    suite name

Returns:



20
21
22
# File 'lib/sevgi/showcase/minitest/suite.rb', line 20

def [](suite)
  (@cache ||= {})[suite] ||= @scripts.select { |script| script.suite == suite.to_s }
end

#non_validsArray<Sevgi::Test::Script>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns scripts expected to be invalid.

Returns:



35
36
37
# File 'lib/sevgi/showcase/minitest/suite.rb', line 35

def non_valids
  NON_VALIDS.map { self[it] }.flatten
end

#suitesArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns all suite names.

Returns:

  • (Array<String>)


26
27
28
# File 'lib/sevgi/showcase/minitest/suite.rb', line 26

def suites
  @suites ||= @scripts.map(&:suite).uniq
end

#validsArray<Sevgi::Test::Script> Also known as: to_a

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns scripts expected to render successfully.

Returns:



41
42
43
# File 'lib/sevgi/showcase/minitest/suite.rb', line 41

def valids
  suites.reject { NON_VALIDS.include?(it) }.map { self[it] }.flatten
end