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.
-
#name ⇒ String
writeonly
Name of the tool to create.
-
#seed ⇒ Integer?
writeonly
The random seed, or
nil
if 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, 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, context_directory: nil) ⇒ Minitest
Create the template settings for the Minitest template.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# 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 |
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.
161 162 163 |
# File 'lib/toys/templates/minitest.rb', line 161 def bundler=(value) @bundler = value end |
#context_directory=(value) ⇒ String
Custom context directory for this tool.
148 149 150 |
# File 'lib/toys/templates/minitest.rb', line 148 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.
116 117 118 |
# File 'lib/toys/templates/minitest.rb', line 116 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.
98 99 100 |
# File 'lib/toys/templates/minitest.rb', line 98 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.
107 108 109 |
# File 'lib/toys/templates/minitest.rb', line 107 def libs=(value) @libs = value end |
#name=(value) ⇒ String
Name of the tool to create.
87 88 89 |
# File 'lib/toys/templates/minitest.rb', line 87 def name=(value) @name = value end |
#seed=(value) ⇒ Integer?
The random seed, or nil
if not specified.
124 125 126 |
# File 'lib/toys/templates/minitest.rb', line 124 def seed=(value) @seed = value end |
#verbose=(value) ⇒ Boolean
Whether to produce verbose output.
132 133 134 |
# File 'lib/toys/templates/minitest.rb', line 132 def verbose=(value) @verbose = value end |
#warnings=(value) ⇒ Boolean
Whether to run tests with Ruby warnings.
140 141 142 |
# File 'lib/toys/templates/minitest.rb', line 140 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.
173 174 175 176 |
# File 'lib/toys/templates/minitest.rb', line 173 def use_bundler(**opts) @bundler = opts self end |