Module: Easytest::DSL

Defined in:
lib/easytest/dsl.rb

Instance Method Summary collapse

Instance Method Details

#after(&block) ⇒ Object



12
13
14
# File 'lib/easytest/dsl.rb', line 12

def after(&block)
  Easytest.add_hook Hook.new(type: :after, block: block)
end

#before(&block) ⇒ Object



8
9
10
# File 'lib/easytest/dsl.rb', line 8

def before(&block)
  Easytest.add_hook Hook.new(type: :before, block: block)
end

#expect(actual = nil) ⇒ Object



26
27
28
# File 'lib/easytest/dsl.rb', line 26

def expect(actual = nil, &)
  Expectation.new(actual, &)
end

#only(name, &block) ⇒ Object



21
22
23
24
# File 'lib/easytest/dsl.rb', 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, &block) ⇒ Object



16
17
18
19
# File 'lib/easytest/dsl.rb', line 16

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) ⇒ Object



3
4
5
6
# File 'lib/easytest/dsl.rb', line 3

def test(name, &block)
  Utils.raise_if_no_test_name(name, method: "test")
  Easytest.add_case Case.new(name: name, block: block)
end