Class: Ace::TestSupport::BaseTestCase

Inherits:
Minitest::Test
  • Object
show all
Includes:
SubprocessRunner, TestHelper
Defined in:
lib/ace/test_support/base_test_case.rb

Overview

Base test case class with common utilities for all ace-* gems

Instance Method Summary collapse

Methods included from SubprocessRunner

#run_in_clean_env, #run_in_subprocess, #run_in_temp_dir, #run_isolated_test_file

Methods included from TestHelper

#assert_directory_exists, #assert_file_content, #assert_file_exists, #capture_stderr, #capture_stdout, #capture_subprocess_io, #clear_project_root_cache, #create_config_file, #with_temp_dir, #with_temp_file

Instance Method Details

#fixture_path(path) ⇒ Object



12
13
14
# File 'lib/ace/test_support/base_test_case.rb', line 12

def fixture_path(path)
  File.expand_path("fixtures/#{path}", File.dirname(caller_locations(1, 1)[0].path))
end

#setupObject



16
17
18
19
20
21
22
23
# File 'lib/ace/test_support/base_test_case.rb', line 16

def setup
  @original_pwd = Dir.pwd
  super
  # Enable test mode by default - tests needing real config use with_real_config
  if defined?(Ace::Support::Config) && Ace::Support::Config.respond_to?(:test_mode=)
    Ace::Support::Config.test_mode = true
  end
end

#teardownObject



25
26
27
28
# File 'lib/ace/test_support/base_test_case.rb', line 25

def teardown
  Dir.chdir(@original_pwd) if @original_pwd
  super
end