Class: Testdata

Inherits:
Object
  • Object
show all
Includes:
AppRoutes, REXML
Defined in:
lib/testdata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s, options = {}) ⇒ Testdata

Returns a new instance of Testdata.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/testdata.rb', line 20

def initialize(s, options={})
  
  super()

  @params = {}
  #routes()

  @success = [] # used by summary
  @debug = false

  # open the testdata document
  procs = {
    String: proc {|x|
                  
      if x.strip[/^</] then
        x
      elsif x[/https?:\/\//] then
        read_url x
      else
        read_file x
      end                   
    },
    Polyrex: proc {|x| x.to_xml}
  }

  buffer =  procs[s.class.to_s.to_sym].call(s)

  @doc = Document.new(buffer)

  o = {log: false}.merge(options)
  @log =  o[:log] == true ? Document.new(tests) : nil
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



18
19
20
# File 'lib/testdata.rb', line 18

def debug
  @debug
end

Instance Method Details

#run(x = nil, debug2 = nil) ⇒ Object



53
54
55
56
57
58
59
60
# File 'lib/testdata.rb', line 53

def run(x=nil, debug2=nil)
  @debug2 = debug2 ? true : false
  @success = []
  procs = {NilClass: :test_all, Range: :test_all, String: :test_id, Fixnum: :test_id}

  method(procs[x.class.to_s.to_sym]).call(x)
  summary()
end