Class: ApiPi::Case

Inherits:
Object show all
Defined in:
lib/api_pi/case.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, tests) ⇒ Case

Returns a new instance of Case.



5
6
7
8
9
10
# File 'lib/api_pi/case.rb', line 5

def initialize(url, tests)
  @tests = tests
  @url = url
  @success_count = 0
  @failure_count = 0
end

Instance Attribute Details

#testsObject (readonly)

Returns the value of attribute tests.



4
5
6
# File 'lib/api_pi/case.rb', line 4

def tests
  @tests
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/api_pi/case.rb', line 4

def url
  @url
end

Instance Method Details

#investigateObject

Begin investigating each GET request and their tests.



14
15
16
17
18
19
20
21
22
# File 'lib/api_pi/case.rb', line 14

def investigate
  puts "\nRequesting JSON from #{url} and testing"
  tests.each_pair do |test, block|
    print " - #{test}\n"
    check test, block
  end
  summary
  exit_status
end