Module: Easytest::DSL
- Defined in:
- sig/easytest.rbs,
lib/easytest/dsl.rb
Overview
Define methods for the Easytest DSL.
Instance Method Summary collapse
-
#after {|case| ... } ⇒ void
Run the given block after each test case.
-
#before {|case| ... } ⇒ void
Run the given block before each test case.
-
#expect(actual = nil) { ... } ⇒ Object
Expect the given object or block to satisfy some criterion.
-
#only(name) { ... } ⇒ void
Run only the given test case.
-
#skip(name) { ... } ⇒ void
Skip the given test case.
-
#test(name, &block) ⇒ void
Define a test case.
Instance Method Details
#after {|case| ... } ⇒ void
This method returns an undefined value.
Run the given block after each test case.
15 16 17 |
# File 'sig/easytest.rbs', line 15 def after(&block) Easytest.add_hook Hook.new(type: :after, block: block) end |
#before {|case| ... } ⇒ void
This method returns an undefined value.
Run the given block before each test case.
12 13 14 |
# File 'sig/easytest.rbs', line 12 def before(&block) Easytest.add_hook Hook.new(type: :before, block: block) end |
#expect(actual) ⇒ Easytest::Expectation #expect ⇒ Easytest::Expectation
Expect the given object or block to satisfy some criterion.
24 25 26 |
# File 'sig/easytest.rbs', line 24 def expect(actual = nil, &) Expectation.new(actual, &) end |
#only(name) { ... } ⇒ void
This method returns an undefined value.
Run only the given test case.
21 22 23 24 |
# File 'sig/easytest.rbs', line 21 def only(name, &block) Utils.raise_if_no_test_name(name, method: "only") Easytest.add_case Case.new(name: name, only: true, block: block) end |
#skip(name) { ... } ⇒ void
This method returns an undefined value.
Skip the given test case.
18 19 20 21 |
# File 'sig/easytest.rbs', line 18 def skip(name, &block) Utils.raise_if_no_test_name(name, method: "skip") Easytest.add_case Case.new(name: name, skipped: true, block: block) end |
#test(name, &block) ⇒ void
This method returns an undefined value.
Define a test case. If omitting a block, the case is considered a to-do.
9 10 11 12 |
# File 'sig/easytest.rbs', line 9 def test(name, &block) Utils.raise_if_no_test_name(name, method: "test") Easytest.add_case Case.new(name: name, block: block) end |