Module: Tap::Test
- Defined in:
- lib/tap/test.rb,
lib/tap/test/utils.rb,
lib/tap/test/version.rb,
lib/tap/test/tap_test.rb,
lib/tap/test/file_test.rb,
lib/tap/test/shell_test.rb,
lib/tap/test/subset_test.rb,
lib/tap/test/file_test/class_methods.rb,
lib/tap/test/shell_test/class_methods.rb,
lib/tap/test/shell_test/regexp_escape.rb,
lib/tap/test/subset_test/class_methods.rb
Overview
Tap::Test provides several convenience methods for including and setting up Tap::Test modules. The manual use of this module looks like this:
class SampleTest < Test::Unit::TestCase
extend Tap::Test
acts_as_tap_test
end
The ‘tap/test/unit’ file performs this setup for Test::Unit (ruby < 1.9) and Mini::Test (ruby >= 1.9); simply require it and call the setup methods as necessary.
Defined Under Namespace
Modules: FileTest, ShellTest, SubsetTest, TapTest, Utils
Constant Summary collapse
Instance Method Summary collapse
-
#acts_as_file_test(options = {}) ⇒ Object
Includes FileTest in the calling class and instantiating class_test_root (a Tap::Root).
-
#acts_as_shell_test(options = nil) ⇒ Object
Includes ShellTest in the calling class.
-
#acts_as_subset_test ⇒ Object
Includes SubsetTest in the calling class.
-
#acts_as_tap_test(options = {}) ⇒ Object
Includes TapTest in the calling class and calls acts_as_file_test with the options.
Instance Method Details
#acts_as_file_test(options = {}) ⇒ Object
Includes FileTest in the calling class and instantiating class_test_root (a Tap::Root). Options may be used to configure the class_test_root.
Note: by default acts_as_file_test determines a root directory based on the calling file. Be sure to specify the root directory manually if you call acts_as_file_test from a file that isn’t the test file.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/tap/test.rb', line 37 def acts_as_file_test(={}) include Tap::Test::FileTest [:root] ||= test_root_dir if .has_key?(:cleanup_dirs) self.cleanup_dirs = .delete(:cleanup_dirs) end self.class_test_root = Tap::Root.new() end |
#acts_as_shell_test(options = nil) ⇒ Object
Includes ShellTest in the calling class. Options are set as the default sh_test_options.
51 52 53 54 |
# File 'lib/tap/test.rb', line 51 def acts_as_shell_test(=nil) include Tap::Test::ShellTest self..merge!() if end |
#acts_as_subset_test ⇒ Object
Includes SubsetTest in the calling class.
26 27 28 |
# File 'lib/tap/test.rb', line 26 def acts_as_subset_test include Tap::Test::SubsetTest end |