Module: DataMapper::Spec::PendingHelpers

Defined in:
lib/dm-core/spec/lib/pending_helpers.rb

Instance Method Summary collapse

Instance Method Details

#pending_if(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/dm-core/spec/lib/pending_helpers.rb', line 5

def pending_if(*args)
  message, boolean = parse_args(*args)

  if boolean
    pending(message) { yield }
  else
    yield
  end
end

#rescue_if(*args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dm-core/spec/lib/pending_helpers.rb', line 15

def rescue_if(*args)
  message, boolean = parse_args(*args)

  if boolean
    raised = nil
    begin
      yield
      raised = false
    rescue Exception
      raised = true
    end

    raise "should have raised: #{message || 'TODO'}" if raised == false
  else
    yield
  end
end