Top Level Namespace

Defined Under Namespace

Modules: Tet Classes: IntendedError, IntendedErrorChild

Instance Method Summary collapse

Instance Method Details

#assert(label = '', &block) ⇒ Object

Assert that a block will return a truthy value



17
18
19
20
21
22
23
24
25
# File 'lib/tet.rb', line 17

def assert label = '', &block
  Tet.run(
    label:   label,
    test:    block,
    no_nest: true,
    truthy:  -> { Tet.passed },
    falsy:   -> { Tet.failed }
  )
end

#err(label = '', expect: StandardError, &block) ⇒ Object

Assert that a block will err



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tet.rb', line 28

def err label = '', expect: StandardError, &block
  Tet.run(
    label:   label,
    test:    block,
    no_nest: true,
    truthy:  -> { Tet.failed },
    falsy:   -> { Tet.failed },
    error:   ->(caught) {
               (expect >= caught.class) ? Tet.passed : Tet.erred(caught, expect)
             }
  )
end

#group(label, &block) ⇒ Object

Label a block of tests



9
10
11
12
13
14
# File 'lib/tet.rb', line 9

def group label, &block
  Tet.run(
    label: label,
    test:  block
  )
end