Module: Toys::Testing::ClassMethods

Defined in:
lib/toys/testing.rb

Overview

Class methods added to a test class or describe block when Toys::Testing is included. Generally, these are methods that configure the load path for the CLI in scope for the block.

Instance Method Summary collapse

Instance Method Details

#toys_custom_paths(paths = :read) ⇒ Object

Configure the Toys CLI to load tools from the given paths, and ignore the current directory and global paths.

Parameters:

  • paths (String, Array<String>) (defaults to: :read)

    The paths to load from.



227
228
229
230
231
232
233
234
235
# File 'lib/toys/testing.rb', line 227

def toys_custom_paths(paths = :read)
  @toys_custom_paths = paths unless paths == :read
  return @toys_custom_paths if defined?(@toys_custom_paths)
  begin
    super
  rescue ::NoMethodError
    Testing.toys_custom_paths
  end
end

#toys_include_builtins(value = :read) ⇒ Object

Configure the Toys CLI to include or exclude builtins. Normally builtins are included unless false is passed to this method.

Parameters:

  • value (boolean) (defaults to: :read)

    Whether to include builtins.



243
244
245
246
247
248
249
250
251
# File 'lib/toys/testing.rb', line 243

def toys_include_builtins(value = :read)
  @toys_include_builtins = value unless value == :read
  return @toys_include_builtins if defined?(@toys_include_builtins)
  begin
    super
  rescue ::NoMethodError
    Testing.toys_include_builtins
  end
end