Class: Minitest::Spec
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Minitest::Test
|
Defined in: | lib/minitest/spec.rb |
Overview
Spec
– The faster, better, less-magical spec framework!
For a list of expectations, see Expectations
.
Constant Summary
-
TYPES =
Internal use only
# File 'lib/minitest/spec.rb', line 324DSL::TYPES
Runnable
- Inherited
Assertions
- Included
Test
- Inherited
Class Attribute Summary
Class Method Summary
- .current Internal use only
- .new(name) ⇒ Spec constructor Internal use only
DSL
- Extended
after | Define an ‘after’ action. |
before | Define a ‘before’ action. |
it | Define an expectation with name |
let | Essentially, define an accessor for |
register_spec_type | Register a new type of spec that matches the spec’s description. |
spec_type | Figure out the spec class to use based on a spec’s description. |
specify | Alias for DSL#it. |
subject | Another lazy man’s accessor generator. |
children, create, describe_stack, name, nuke_test_methods!, to_s |
Test
- Inherited
.i_suck_and_my_tests_are_order_dependent! | Call this at the top of your tests when you absolutely positively need to have ordered tests. |
.make_my_diffs_pretty! | Make diffs for this |
.parallelize_me! | Call this at the top of your tests when you want to run your tests in parallel. |
.runnable_methods | Returns all instance methods starting with “test_”. |
.test_order | Defines the order to run tests (:random by default). |
Guard
- Extended
jruby? | Is this running on jruby? |
maglev? | Is this running on maglev? |
mri? | Is this running on mri? |
rubinius? | Is this running on rubinius? |
windows? | Is this running on windows? |
Runnable
- Inherited
.methods_matching | Returns all instance methods matching the pattern |
.run | Responsible for running all runnable methods in a given class, each in its own instance. |
.run_one_method | Runs a single method and has the reporter record the result. |
.runnable_methods | Each subclass of |
.runnables | Returns all subclasses of |
.inherited, .new, .on_signal, .reset, .with_info_handler |
Instance Attribute Summary
Reportable
- Included
Assertions
- Included
#skipped? | Was this testcase skipped? Meant for |
Runnable
- Inherited
Instance Method Summary
Test
- Inherited
#run | Runs a single test with setup/teardown hooks. |
#capture_exceptions | LifecycleHooks. |
#class_name, #with_info_handler |
Guard
- Included
#jruby? | Is this running on jruby? |
#maglev? | Is this running on maglev? |
#mri? | Is this running on mri? |
#rubinius? | Is this running on rubinius? |
#windows? | Is this running on windows? |
Test::LifecycleHooks
- Included
#after_setup | Runs before every test, after setup. |
#after_teardown | Runs after every test, after teardown. |
#before_setup | Runs before every test, before setup. |
#before_teardown | Runs after every test, before teardown. |
#setup | Runs before every test. |
#teardown | Runs after every test. |
Reportable
- Included
#location | The location identifier of this test. |
#result_code | Returns “.”, “F”, or “E” based on the result of the run. |
#class_name |
Assertions
- Included
#assert | Fails unless |
#assert_empty | Fails unless |
#assert_equal | Fails unless |
#assert_in_delta | For comparing Floats. |
#assert_in_epsilon | For comparing Floats. |
#assert_includes | Fails unless |
#assert_instance_of | Fails unless |
#assert_kind_of | Fails unless |
#assert_match | Fails unless |
#assert_mock | Assert that the mock verifies correctly. |
#assert_nil | Fails unless |
#assert_operator | For testing with binary operators. |
#assert_output | Fails if stdout or stderr do not output the expected results. |
#assert_predicate | For testing with predicates. |
#assert_raises | Fails unless the block raises one of |
#assert_respond_to | Fails unless |
#assert_same | Fails unless |
#assert_send |
|
#assert_silent | Fails if the block outputs anything to stderr or stdout. |
#assert_throws | Fails unless the block throws |
#capture_io | Captures $stdout and $stderr into strings: |
#capture_subprocess_io | Captures $stdout and $stderr into strings, using Tempfile to ensure that subprocess IO is captured as well. |
#diff | Returns a diff between |
#exception_details | Returns details for exception |
#flunk | Fails with |
#message | Returns a proc that will output |
#mu_pp | This returns a human-readable version of |
#mu_pp_for_diff | This returns a diff-able human-readable version of |
#pass | used for counting assertions. |
#refute | Fails if |
#refute_empty | Fails if |
#refute_equal | Fails if |
#refute_in_delta | For comparing Floats. |
#refute_in_epsilon | For comparing Floats. |
#refute_includes | Fails if |
#refute_instance_of | Fails if |
#refute_kind_of | Fails if |
#refute_match | Fails if |
#refute_nil | Fails if |
#refute_operator | Fails if |
#refute_predicate | For testing with predicates. |
#refute_respond_to | Fails if |
#refute_same | Fails if |
#skip | Skips the current run. |
#_synchronize |
Runnable
- Inherited
#result_code | Returns a single character string to print based on the result of the run. |
#run | Runs a single method. |
#failure, #marshal_dump, #marshal_load, #time_it |
Constructor Details
.new(name) ⇒ Spec
# File 'lib/minitest/spec.rb', line 101
def initialize name # :nodoc: super Thread.current[:current_spec] = self end
Class Method Details
.current
# File 'lib/minitest/spec.rb', line 97
def self.current # :nodoc: Thread.current[:current_spec] end