Module: Minitest
- Defined in:
- lib/minitest/holdify_plugin.rb
Overview
Implement the minitest plugin
Defined Under Namespace
Modules: Assertions Classes: Assertion, Test
Class Method Summary collapse
-
.plugin_holdify_init(options) ⇒ Object
Register the after_run hook to persist all data.
-
.plugin_holdify_options(opts, options) ⇒ Object
Set the Holdify options.
Class Method Details
.plugin_holdify_init(options) ⇒ Object
Register the after_run hook to persist all data
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/minitest/holdify_plugin.rb', line 31 def self.plugin_holdify_init() # :nocov: git = system('git --version', out: File::NULL, err: File::NULL) Holdify.pwd = git ? `git rev-parse --show-toplevel`.strip : Dir.pwd # :nocov: Holdify.reconcile = [:holdify_reconcile] Holdify.quiet = [:holdify_quiet] Holdify.git_diff = git unless [:holdify_no_git_diff] Holdify.color = !ENV.key?('NO_COLOR') unless [:holdify_no_color] Holdify.rel_paths = true unless [:holdify_absolute_paths] Holdify.store_ext = [:holdify_store_ext] || '.yaml' Minitest.after_run do Holdify.persist_stores! Holdify.warn_fresh_values end end |
.plugin_holdify_options(opts, options) ⇒ Object
Set the Holdify options
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/minitest/holdify_plugin.rb', line 8 def self.(opts, ) opts.on '--holdify-reconcile', 'Reconcile the held values with the new ones (enables quiet)' do [:holdify_reconcile] = true [:holdify_quiet] = true end opts.on '--holdify-quiet', 'Skip the warning on storing a new value' do [:holdify_quiet] = true end opts.on '--holdify-no-git-diff', 'Disable git-diff' do [:holdify_no_git_diff] = true end opts.on '--holdify-no-color', 'Disable colored output' do [:holdify_no_color] = true end opts.on '--holdify-absolute-paths', 'Disable relative paths in file references' do [:holdify_absolute_paths] = true end opts.on '--holdify-store-ext EXT', 'The yaml store extension (default .yaml)' do |ext| [:holdify_store_ext] = ext end end |