Class: Lemon::TestMethod::Scope
- Inherits:
-
Lemon::TestCase::Scope
- Object
- Module
- World
- Lemon::TestCase::Scope
- Lemon::TestMethod::Scope
- Defined in:
- lib/lemon/test_method.rb
Overview
Scope for evaluating method test definitions.
Instance Method Summary collapse
-
#context(label, &block) ⇒ Object
(also: #Context)
Create a sub-case ofr the method case.
-
#omit(label = true, &block) ⇒ Object
(also: #Omit)
Omit tests.
-
#skip(label = true, &block) ⇒ Object
(also: #Skip)
Skip tests.
-
#test(label = nil, &block) ⇒ Object
(also: #Test)
Define a unit test for this case.
Methods inherited from Lemon::TestCase::Scope
#after, #before, #initialize, #setup, #teardown
Constructor Details
This class inherits a constructor from Lemon::TestCase::Scope
Instance Method Details
#context(label, &block) ⇒ Object Also known as: Context
Create a sub-case ofr the method case.
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/lemon/test_method.rb', line 159 def context(label, &block) @_testcase.tests << TestMethod.new( :context => @_testcase, :target => @_testcase.target, :setup => @_setup, :skip => @_skip, :label => label, &block ) end |
#omit(label = true, &block) ⇒ Object Also known as: Omit
Omit tests.
180 181 182 183 184 |
# File 'lib/lemon/test_method.rb', line 180 def omit(label=true, &block) @_omit = label block.call @_omit = nil end |
#skip(label = true, &block) ⇒ Object Also known as: Skip
Skip tests. Unlike omit, skipped tests are not executed at all.
196 197 198 199 200 |
# File 'lib/lemon/test_method.rb', line 196 def skip(label=true, &block) @_skip = label block.call @_skip = nil end |
#test(label = nil, &block) ⇒ Object Also known as: Test
Define a unit test for this case.
144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/lemon/test_method.rb', line 144 def test(label=nil, &block) block = Omission.new(@_omit).to_proc if @_omit test = TestProc.new( :context => @_testcase, :setup => @_setup, :skip => @_skip, :label => label, &block ) @_testcase.tests << test test end |