Class: TestBoosters::Boosters::Minitest

Inherits:
Base
  • Object
show all
Defined in:
lib/test_boosters/boosters/minitest.rb

Constant Summary collapse

FILE_PATTERN =
"test/**/*_test.rb".freeze

Instance Method Summary collapse

Methods inherited from Base

#after_job, #before_job, #display_header, #distribution, #job_count, #job_index, #run, #show_files_for_dry_run

Constructor Details

#initializeMinitest

Returns a new instance of Minitest.



7
8
9
# File 'lib/test_boosters/boosters/minitest.rb', line 7

def initialize
  super(FILE_PATTERN, nil, split_configuration_path, command)
end

Instance Method Details

#commandObject



11
12
13
14
15
16
17
18
19
# File 'lib/test_boosters/boosters/minitest.rb', line 11

def command
  if command_set_with_env_var?
    command_from_env_var
  elsif rails_app?
    "bundle exec rails test"
  else
    "ruby -e 'ARGV.each { |f| require \"./\#{f}\" }'"
  end
end

#command_from_env_varObject



29
30
31
# File 'lib/test_boosters/boosters/minitest.rb', line 29

def command_from_env_var
  ENV["MINITEST_BOOSTER_COMMAND"].to_s
end

#command_set_with_env_var?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/test_boosters/boosters/minitest.rb', line 25

def command_set_with_env_var?
  !command_from_env_var.empty?
end

#split_configuration_pathObject



21
22
23
# File 'lib/test_boosters/boosters/minitest.rb', line 21

def split_configuration_path
  ENV["MINITEST_SPLIT_CONFIGURATION_PATH"] || "#{ENV["HOME"]}/minitest_split_configuration.json"
end