Class: Test::Unit::TestCase
Class Method Summary collapse
-
.disallow_helpers! ⇒ Object
call-seq: disallow_helpers!.
-
.disallow_helpers? ⇒ Boolean
:nodoc:.
-
.disallow_setup! ⇒ Object
call-seq: disallow_setup!.
-
.disallow_setup? ⇒ Boolean
:nodoc:.
-
.test(name, &block) ⇒ Object
call-seq: test(name, &block).
Class Method Details
.disallow_helpers! ⇒ Object
call-seq: disallow_helpers!
Used to disallow helper methods in test specifications.
Test::Unit::TestCase.disallow_helper!
A test specification can override this behavior by passing the helper name (as a symbol) in the :allow options.
unit_tests :allow => [:create_something, :destroy_something] do
test "verify something" do
...
end
def create_something
...
end
def destroy_something
...
end
end
50 51 52 |
# File 'lib/test_case_extension.rb', line 50 def self.disallow_helpers! @disallow_helpers = true end |
.disallow_helpers? ⇒ Boolean
:nodoc:
54 55 56 |
# File 'lib/test_case_extension.rb', line 54 def self.disallow_helpers? #:nodoc: @disallow_helpers end |
.disallow_setup! ⇒ Object
21 22 23 |
# File 'lib/test_case_extension.rb', line 21 def self.disallow_setup! @disallow_setup = true end |
.disallow_setup? ⇒ Boolean
:nodoc:
25 26 27 |
# File 'lib/test_case_extension.rb', line 25 def self.disallow_setup? #:nodoc: @disallow_setup end |
.test(name, &block) ⇒ Object
call-seq: test(name, &block)
Used to define a test and assign it a descriptive name.
unit_tests do
test "verify something" do
...
end
end
67 68 69 70 71 72 73 |
# File 'lib/test_case_extension.rb', line 67 def self.test(name, &block) test_name = "test_#{name.gsub(/[\s]/,'_')}".to_sym raise "#{test_name} is already defined in #{self}" if self.instance_methods.include? test_name.to_s define_method test_name do instance_eval &block end end |