module Test::This
@!attribute file_suffix
Test files are typically suffixed with either `_test.rb` or `_spec.rb`. This attribute allows you to specify what file suffix your tests use. @return [String] A file suffix - defaults to "_test.rb".
@!attribute test_method_prefix
Minitest methods are prefixed with `test_`. The Rails `test` method generates tests for Minitest that have the same prefix. This might not apply to all test suites, so it can be configured when necessary. @return [String] Prefix for test methods.
@!attribute test_path
The full path to the root of the tests. This defaults to using the current directory that the task was called from. @return [String] Full path to the tests.
Constants
- VERSION
Attributes
file_suffix[W]
test_method_prefix[W]
test_path[W]
Public Class Methods
execute(path, name=nil)
click to toggle source
# File lib/test/this.rb, line 44 def self.execute(path, name=nil) path = get_test_path(path) command = %Q[ruby -I"lib:test" #{path}] command << " -n #{get_test_name(name)}" unless name.nil? system command end
file_suffix()
click to toggle source
# File lib/test/this.rb, line 32 def self.file_suffix @file_suffix ||= '_test.rb' end
get_test_name(name)
click to toggle source
# File lib/test/this.rb, line 57 def self.get_test_name(name) "#{test_method_prefix}#{name.gsub(' ', '_')}" end
get_test_path(path)
click to toggle source
# File lib/test/this.rb, line 53 def self.get_test_path(path) File.join(test_path, "#{path}#{file_suffix}") end
test_method_prefix()
click to toggle source
# File lib/test/this.rb, line 36 def self.test_method_prefix @test_method_prefix ||= 'test_' end
test_path()
click to toggle source
# File lib/test/this.rb, line 40 def self.test_path @test_path ||= File.join(Dir.pwd, 'test') end