Module: Minitest

Defined in:
lib/minitest/snapshots_plugin.rb,
lib/minitest/snapshots/version.rb,
lib/minitest/snapshots/serializer.rb,
lib/minitest/snapshots/test_extensions.rb,
lib/minitest/snapshots/assertion_extensions.rb

Defined Under Namespace

Modules: Assertions, Snapshots

Class Method Summary collapse

Class Method Details

.plugin_snapshots_init(_options) ⇒ Object



17
18
19
20
21
# File 'lib/minitest/snapshots_plugin.rb', line 17

def self.plugin_snapshots_init(_options)
  require_relative "snapshots/test_extensions"
  require_relative "snapshots/assertion_extensions"
  Minitest::Test.include Minitest::Snapshots::TestExtensions
end

.plugin_snapshots_options(opts, _options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/minitest/snapshots_plugin.rb', line 5

def self.plugin_snapshots_options(opts, _options)
  Minitest::Snapshots.lock_snapshots = !ENV["CI"].to_s.empty?

  opts.on "-u", "--update-snapshots", "Update (overwrite) stored snapshots" do
    Minitest::Snapshots.force_updates = true
  end

  opts.on "-l", "--[no-]lock-snapshots", "Prevent any snapshots from being stored" do |bool|
    Minitest::Snapshots.lock_snapshots = bool
  end
end