Class: TestLauncher::Frameworks::Minitest::TestCase

Inherits:
Base::TestCase show all
Defined in:
lib/test_launcher/frameworks/minitest.rb

Instance Attribute Summary

Attributes inherited from Implementation::TestCase

#file, #line_number, #request

Instance Method Summary collapse

Methods inherited from Implementation::TestCase

#app_root, #exploded_path, from_search, #initialize, #is_example?, #mtime, #relative_file, #test_root

Constructor Details

This class inherits a constructor from TestLauncher::Frameworks::Implementation::TestCase

Instance Method Details

#exampleObject



175
176
177
178
# File 'lib/test_launcher/frameworks/minitest.rb', line 175

def example
  @memoized_example if defined?(@memoized_example)
  @memoized_example = @example&.gsub(" ", "_")
end

#example_runnerObject



143
144
145
146
147
148
149
# File 'lib/test_launcher/frameworks/minitest.rb', line 143

def example_runner
  if spring_enabled?
    "bundle exec spring rails test"
  else
    "bundle exec ruby -I test"
  end
end

#file_runnerObject



151
152
153
154
155
156
157
# File 'lib/test_launcher/frameworks/minitest.rb', line 151

def file_runner
  if spring_enabled?
    "bundle exec spring rails test"
  else
    "bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}'"
  end
end

#spring_enabled?Boolean

Returns:

  • (Boolean)


163
164
165
166
167
168
169
170
171
172
173
# File 'lib/test_launcher/frameworks/minitest.rb', line 163

def spring_enabled?
  return false if request.disable_spring?
  return true if request.force_spring?

  [
    "bin/spring",
    "bin/testunit"
  ].any? {|f|
    File.exist?(File.join(app_root, f))
  }
end

#test_root_dir_nameObject



159
160
161
# File 'lib/test_launcher/frameworks/minitest.rb', line 159

def test_root_dir_name
  "test"
end