Module: Kernel

Defined in:
lib/dfect/mini.rb,
lib/dfect/spec.rb,
lib/dfect/unit.rb

Instance Method Summary collapse

Instance Method Details

#after(what, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/dfect/spec.rb', line 29

def after what, &block
  meth =
    case what
    when :each then :>
    when :all  then :>>
    else raise ArgumentError, what
    end

  Dfect.send meth, &block
end

#before(what, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/dfect/spec.rb', line 18

def before what, &block
  meth =
    case what
    when :each then :<
    when :all  then :<<
    else raise ArgumentError, what
    end

  Dfect.send meth, &block
end

#describe(*args, &block) ⇒ Object Also known as: context, it



11
12
13
# File 'lib/dfect/spec.rb', line 11

def describe *args, &block
  Dfect.D args.join(' '), &block
end

#setup(&block) ⇒ Object



10
11
12
# File 'lib/dfect/unit.rb', line 10

def setup &block
  Dfect.<(&block)
end

#teardown(&block) ⇒ Object



14
15
16
# File 'lib/dfect/unit.rb', line 14

def teardown &block
  Dfect.>(&block)
end