Class: Toys::Templates::Minitest
- Inherits:
-
Object
- Object
- Toys::Templates::Minitest
- Includes:
- 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.
-
#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) ⇒ Minitest
constructor
Create the template settings for the Minitest template.
-
#use_bundler(**opts) ⇒ self
Use bundler for this tool.
Constructor Details
#initialize(name: nil, gem_version: nil, libs: nil, files: nil, seed: nil, verbose: false, warnings: true, bundler: false) ⇒ Minitest
Create the template settings for the Minitest template.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/toys/templates/minitest.rb', line 59 def initialize(name: nil, gem_version: nil, libs: nil, files: nil, seed: nil, verbose: false, warnings: true, bundler: false) @name = name @gem_version = gem_version @libs = libs @files = files @seed = seed @verbose = verbose @warnings = warnings @bundler = bundler 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.
149 150 151 |
# File 'lib/toys/templates/minitest.rb', line 149 def bundler=(value) @bundler = value end |
#files=(value) ⇒ String, ...
An array of globs indicating the test files to load.
If set to nil
, defaults to DEFAULT_FILES.
112 113 114 |
# File 'lib/toys/templates/minitest.rb', line 112 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.
94 95 96 |
# File 'lib/toys/templates/minitest.rb', line 94 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.
103 104 105 |
# File 'lib/toys/templates/minitest.rb', line 103 def libs=(value) @libs = value end |
#name=(value) ⇒ String
Name of the tool to create.
83 84 85 |
# File 'lib/toys/templates/minitest.rb', line 83 def name=(value) @name = value end |
#seed=(value) ⇒ Integer?
The random seed, or nil
if not specified.
120 121 122 |
# File 'lib/toys/templates/minitest.rb', line 120 def seed=(value) @seed = value end |
#verbose=(value) ⇒ Boolean
Whether to produce verbose output.
128 129 130 |
# File 'lib/toys/templates/minitest.rb', line 128 def verbose=(value) @verbose = value end |
#warnings=(value) ⇒ Boolean
Whether to run tests with Ruby warnings.
136 137 138 |
# File 'lib/toys/templates/minitest.rb', line 136 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.
161 162 163 164 |
# File 'lib/toys/templates/minitest.rb', line 161 def use_bundler(**opts) @bundler = opts self end |