Class Index [+]

Quicksearch

DataMapper::Spec::PendingHelpers

Public Instance Methods

pending_if(*args) click to toggle source
    # File lib/dm-core/spec/lib/pending_helpers.rb, line 5
 5:       def pending_if(*args)
 6:         message, boolean = parse_args(*args)
 7: 
 8:         if boolean
 9:           pending(message) { yield }
10:         else
11:           yield
12:         end
13:       end
rescue_if(*args) click to toggle source
    # File lib/dm-core/spec/lib/pending_helpers.rb, line 15
15:       def rescue_if(*args)
16:         message, boolean = parse_args(*args)
17: 
18:         if boolean
19:           raised = nil
20:           begin
21:             yield
22:             raised = false
23:           rescue Exception
24:             raised = true
25:           end
26: 
27:           raise "should have raised: #{message || 'TODO'}" if raised == false
28:         else
29:           yield
30:         end
31:       end

Private Instance Methods

parse_args(*args) click to toggle source
    # File lib/dm-core/spec/lib/pending_helpers.rb, line 35
35:       def parse_args(*args)
36:         case args.map { |arg| arg.class }
37:           when [ String, TrueClass ], [ String, FalseClass ] then args
38:           when [ String, NilClass ]                          then [ args.first, false      ]
39:           when [ String ]                                    then [ args.first, true       ]
40:           when [ TrueClass ], [ FalseClass ]                 then [ '',         args.first ]
41:           when [ NilClass ]                                  then [ '',         false      ]
42:           when []                                            then [ '',         true       ]  # defaults
43:           else
44:             raise ArgumentError, "Invalid arguments: #{args.inspect}"
45:         end
46:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.