Module: CLI::Kit::Support::TestHelper

Defined in:
lib/cli/kit/support/test_helper.rb

Defined Under Namespace

Modules: FakeConfig Classes: FakeSuccess

Instance Method Summary collapse

Instance Method Details

#assert_all_commands_run(should_raise: true) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/cli/kit/support/test_helper.rb', line 12

def assert_all_commands_run(should_raise: true)
  errors = CLI::Kit::System.error_message
  CLI::Kit::System.reset!
  # this is in minitest, but sorbet doesn't know that. probably we
  # could structure this better.
  T.unsafe(self).assert(false, errors) if should_raise && !errors.nil?
  errors
end

#setupObject



7
8
9
10
# File 'lib/cli/kit/support/test_helper.rb', line 7

def setup
  super
  CLI::Kit::System.reset!
end

#teardownObject



21
22
23
24
# File 'lib/cli/kit/support/test_helper.rb', line 21

def teardown
  super
  assert_all_commands_run
end