Module: YardExampleTest
- Defined in:
- lib/yard_example_test.rb,
lib/yard_example_test/rake.rb,
lib/yard_example_test/example.rb,
lib/yard_example_test/version.rb,
lib/yard_example_test/expectation.rb,
lib/yard_example_test/example/evaluator.rb,
lib/yard_example_test/example/comparison.rb,
lib/yard_example_test/example/constant_sandbox.rb
Overview
Provides configuration and hooks for running YARD @example tags as tests.
Defined Under Namespace
Classes: Example, Expectation, RakeTask
Constant Summary collapse
- VERSION =
The current gem version
'0.2.1'
Class Method Summary collapse
-
.after(test = nil, &blk)
Registers a block to be called after each example, or after a specific test.
-
.after_run
Registers a block to be called after all examples have run.
-
.before(test = nil, &blk)
Registers a block to be called before each example, or before a specific test.
-
.configure {|self| ... }
Configures YardExampleTest.
-
.hooks ⇒ Hash{Symbol => Array<Hash>}
private
Returns the hash of registered before/after hooks.
-
.skip(test)
Registers a test definition to be skipped.
-
.skips ⇒ Array<String>
private
Returns the array of test definitions registered to be skipped.
Class Method Details
.after(test = nil, &blk)
This method returns an undefined value.
Registers a block to be called after each example, or after a specific test
The block is evaluated in the same context as the example.
75 76 77 |
# File 'lib/yard_example_test.rb', line 75 def self.after(test = nil, &blk) hooks[:after] << { test: test, block: blk } end |
.after_run
This method returns an undefined value.
Registers a block to be called after all examples have run
The block is evaluated in a different context from the examples. Delegates to +Minitest.after_run+.
91 92 93 |
# File 'lib/yard_example_test.rb', line 91 def self.after_run(&) Minitest.after_run(&) end |
.before(test = nil, &blk)
This method returns an undefined value.
Registers a block to be called before each example, or before a specific test
The block is evaluated in the same context as the example.
53 54 55 |
# File 'lib/yard_example_test.rb', line 53 def self.before(test = nil, &blk) hooks[:before] << { test: test, block: blk } end |
.configure {|self| ... }
This method returns an undefined value.
Configures YardExampleTest
31 32 33 |
# File 'lib/yard_example_test.rb', line 31 def self.configure yield self end |
.hooks ⇒ Hash{Symbol => Array<Hash>}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the hash of registered before/after hooks
126 127 128 129 130 131 |
# File 'lib/yard_example_test.rb', line 126 def self.hooks @hooks ||= {}.tap do |hash| hash[:before] = [] hash[:after] = [] end end |
.skip(test)
This method returns an undefined value.
Registers a test definition to be skipped
106 107 108 |
# File 'lib/yard_example_test.rb', line 106 def self.skip(test) skips << test end |
.skips ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the array of test definitions registered to be skipped
116 117 118 |
# File 'lib/yard_example_test.rb', line 116 def self.skips @skips ||= [] end |