Class: Toys::Templates::Minitest
- Inherits:
-
Object
- Object
- Toys::Templates::Minitest
- Includes:
- Toys::Template
- Defined in:
- lib/toys/templates/minitest.rb
Overview
A template for tools that run minitest
Constant Summary collapse
- DEFAULT_GEM_VERSION_REQUIREMENTS =
Default version requirements for the minitest gem.
["~> 5.0"].freeze
- DEFAULT_TOOL_NAME =
Default tool name
"test"- DEFAULT_LIBS =
Default set of library paths
["lib"].freeze
- DEFAULT_FILES =
Default set of test file globs
["test/**/test*.rb"].freeze
Instance Attribute Summary collapse
-
#bundler ⇒ Boolean, Hash
writeonly
Set the bundler state and options for this tool.
-
#context_directory ⇒ String
writeonly
Custom context directory for this tool.
-
#files ⇒ String, ...
writeonly
An array of globs indicating the test files to load.
-
#gem_version ⇒ String, ...
writeonly
Version requirements for the minitest gem.
-
#libs ⇒ String, ...
writeonly
An array of library paths to add to the ruby require path.
-
#mt_compat ⇒ true, ...
writeonly
Adjust the
MT_COMPATenvironment variable when running tests. -
#name ⇒ String
writeonly
Name of the tool to create.
-
#seed ⇒ Integer?
writeonly
The random seed, or
nilif not specified. -
#verbose ⇒ Boolean
writeonly
Whether to produce verbose output.
-
#warnings ⇒ Boolean
writeonly
Whether to run tests with Ruby warnings.
Instance Method Summary collapse
-
#initialize(name: nil, gem_version: nil, libs: nil, files: nil, seed: nil, verbose: false, warnings: true, bundler: false, mt_compat: nil, context_directory: nil) ⇒ Minitest
constructor
Create the template settings for the Minitest template.
-
#use_bundler(**opts) ⇒ self
Use bundler for this tool.
Methods included from Toys::Template
Constructor Details
#initialize(name: nil, gem_version: nil, libs: nil, files: nil, seed: nil, verbose: false, warnings: true, bundler: false, mt_compat: nil, context_directory: nil) ⇒ Minitest
Create the template settings for the Minitest template.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/toys/templates/minitest.rb', line 65 def initialize(name: nil, gem_version: nil, libs: nil, files: nil, seed: nil, verbose: false, warnings: true, bundler: false, mt_compat: nil, context_directory: nil) @name = name @gem_version = gem_version @libs = libs @files = files @seed = seed @verbose = verbose @warnings = warnings @bundler = bundler @mt_compat = mt_compat @context_directory = context_directory end |
Instance Attribute Details
#bundler=(value) ⇒ Boolean, Hash (writeonly)
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
for information on the options that can be passed.
167 168 169 |
# File 'lib/toys/templates/minitest.rb', line 167 def bundler=(value) @bundler = value end |
#context_directory=(value) ⇒ String
Custom context directory for this tool.
154 155 156 |
# File 'lib/toys/templates/minitest.rb', line 154 def context_directory=(value) @context_directory = value end |
#files=(value) ⇒ String, ...
An array of globs indicating the test files to load.
If set to nil, defaults to DEFAULT_FILES.
122 123 124 |
# File 'lib/toys/templates/minitest.rb', line 122 def files=(value) @files = value end |
#gem_version=(value) ⇒ String, ...
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.
104 105 106 |
# File 'lib/toys/templates/minitest.rb', line 104 def gem_version=(value) @gem_version = value end |
#libs=(value) ⇒ String, ...
An array of library paths to add to the ruby require path.
If set to nil, defaults to DEFAULT_LIBS.
113 114 115 |
# File 'lib/toys/templates/minitest.rb', line 113 def libs=(value) @libs = value end |
#mt_compat=(value) ⇒ true, ...
Adjust the MT_COMPAT environment variable when running tests. This
setting may be necessary for certain older Minitest plugins.
Pass true to enable compat mode, false to disable it, or nil to
use any ambient setting from the current environment.
179 180 181 |
# File 'lib/toys/templates/minitest.rb', line 179 def mt_compat=(value) @mt_compat = value end |
#name=(value) ⇒ String
Name of the tool to create.
93 94 95 |
# File 'lib/toys/templates/minitest.rb', line 93 def name=(value) @name = value end |
#seed=(value) ⇒ Integer?
The random seed, or nil if not specified.
130 131 132 |
# File 'lib/toys/templates/minitest.rb', line 130 def seed=(value) @seed = value end |
#verbose=(value) ⇒ Boolean
Whether to produce verbose output.
138 139 140 |
# File 'lib/toys/templates/minitest.rb', line 138 def verbose=(value) @verbose = value end |
#warnings=(value) ⇒ Boolean
Whether to run tests with Ruby warnings.
146 147 148 |
# File 'lib/toys/templates/minitest.rb', line 146 def warnings=(value) @warnings = value end |
Instance Method Details
#use_bundler(**opts) ⇒ self
Use bundler for this tool.
See the documentation for the bundler mixin for information on the options that can be passed.
191 192 193 194 |
# File 'lib/toys/templates/minitest.rb', line 191 def use_bundler(**opts) @bundler = opts self end |