class Toys::Templates::Minitest
A template for tools that run minitest
Constants
- DEFAULT_FILES
Default set of test file globs @return [Array<String>]
- DEFAULT_GEM_VERSION_REQUIREMENTS
Default version requirements for the minitest gem. @return [Array<String>]
- DEFAULT_LIBS
Default set of library paths @return [Array<String>]
- DEFAULT_TOOL_NAME
Default tool name @return [String]
Attributes
Set the bundler state and options for this tool.
Pass `false` to disable bundler. Pass `true` or a hash of options to enable bundler. See the documentation for the [bundler mixin](dazuma.github.io/toys/gems/toys-core/latest/Toys/StandardMixins/Bundler) for information on the options that can be passed.
@param value [Boolean,Hash] @return [Boolean,Hash]
Custom context directory for this tool.
@param value [String] @return [String]
An array of globs indicating the test files to load. If set to `nil`, defaults to {DEFAULT_FILES}.
@param value [String,Array<String>,nil] @return [String,Array<String>,nil]
Version requirements for the minitest gem. If set to `nil`, uses the bundled version if bundler is enabled, or defaults to {DEFAULT_GEM_VERSION_REQUIREMENTS} if bundler is not enabled.
@param value [String,Array<String>,nil] @return [String,Array<String>,nil]
An array of library paths to add to the ruby require path. If set to `nil`, defaults to {DEFAULT_LIBS}.
@param value [String,Array<String>,nil] @return [String,Array<String>,nil]
Name of the tool to create.
@param value [String] @return [String]
The random seed, or `nil` if not specified.
@param value [Integer,nil] @return [Integer,nil]
Whether to produce verbose output.
@param value [Boolean] @return [Boolean]
Whether to run tests with Ruby warnings.
@param value [Boolean] @return [Boolean]
Public Class Methods
Create the template settings for the Minitest
template.
@param name [String] Name of the tool to create. Defaults to
{DEFAULT_TOOL_NAME}.
@param gem_version
[String,Array<String>] Version requirements for
the minitest gem. Optional. If not provided, uses the bundled version if bundler is enabled, or defaults to {DEFAULT_GEM_VERSION_REQUIREMENTS} if bundler is not enabled.
@param libs [Array<String>] An array of library paths to add to the
ruby require path. Defaults to {DEFAULT_LIBS}.
@param files [Array<String>] An array of globs indicating the test
files to load. Defaults to {DEFAULT_FILES}.
@param seed [Integer] The random seed, if any. Optional. @param verbose [Boolean] Whether to produce verbose output. Defaults to
false.
@param warnings [Boolean] If true, runs tests with Ruby warnings.
Defaults to true.
@param bundler [Boolean,Hash] If `false` (the default), bundler is not
enabled for this tool. If `true` or a Hash of options, bundler is enabled. See the documentation for the [bundler mixin](https://dazuma.github.io/toys/gems/toys-core/latest/Toys/StandardMixins/Bundler) for information on available options.
@param context_directory
[String] A custom context directory to use
when executing this tool.
# File lib/toys/templates/minitest.rb, line 61 def initialize(name: nil, gem_version: nil, libs: nil, files: nil, seed: nil, verbose: false, warnings: true, bundler: false, context_directory: nil) @name = name @gem_version = gem_version @libs = libs @files = files @seed = seed @verbose = verbose @warnings = warnings @bundler = bundler @context_directory = context_directory end
Public Instance Methods
@private
# File lib/toys/templates/minitest.rb, line 209 def bundler_settings if @bundler && !@bundler.is_a?(::Hash) {} else @bundler end end
@private
# File lib/toys/templates/minitest.rb, line 198 def files @files ? Array(@files) : DEFAULT_FILES end
@private
# File lib/toys/templates/minitest.rb, line 203 def gem_version return Array(@gem_version) if @gem_version @bundler ? [] : DEFAULT_GEM_VERSION_REQUIREMENTS end
@private
# File lib/toys/templates/minitest.rb, line 193 def libs @libs ? Array(@libs) : DEFAULT_LIBS end
@private
# File lib/toys/templates/minitest.rb, line 188 def name @name || DEFAULT_TOOL_NAME end
Use bundler for this tool.
See the documentation for the [bundler mixin](dazuma.github.io/toys/gems/toys-core/latest/Toys/StandardMixins/Bundler) for information on the options that can be passed.
@param opts [keywords] Options for bundler @return [self]
# File lib/toys/templates/minitest.rb, line 173 def use_bundler(**opts) @bundler = opts self end