okapi 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/okapi/spec_parser.rb +3 -2
- data/lib/okapi/test.rb +2 -2
- data/lib/okapi/version.rb +1 -1
- data/test_files/tests.spec +3 -1
- metadata +3 -3
data/lib/okapi/spec_parser.rb
CHANGED
@@ -26,7 +26,7 @@ module Apiary
|
|
26
26
|
def read_file(path)
|
27
27
|
@data = []
|
28
28
|
File.open(path).each do |line|
|
29
|
-
@data << line
|
29
|
+
@data << line if line.strip != ""
|
30
30
|
end
|
31
31
|
@data
|
32
32
|
end
|
@@ -34,8 +34,9 @@ module Apiary
|
|
34
34
|
def parse_data
|
35
35
|
@data.each { |res|
|
36
36
|
splited = res.split(' ',3)
|
37
|
+
|
37
38
|
begin
|
38
|
-
splited[2] = JSON.parse splited[2] if splited[2]
|
39
|
+
splited[2] = JSON.parse splited[2] if splited[2] and splited[2] != ''
|
39
40
|
rescue Exception => e
|
40
41
|
raise Exception, 'can not parse parameters for resource:' + res + "(#{e})"
|
41
42
|
end
|
data/lib/okapi/test.rb
CHANGED
@@ -51,7 +51,7 @@ module Apiary
|
|
51
51
|
|
52
52
|
data = get_requests_spec(resources)
|
53
53
|
|
54
|
-
raise Exception, 'Can not get request data from
|
54
|
+
raise Exception, 'Can not get request data from Apiary: ' + data[:error] || '' if data[:error] or data[:resp].code.to_i != 200
|
55
55
|
|
56
56
|
data[:data].each do |res|
|
57
57
|
raise Exception, 'Resource error "' + res['error'] + '" for resource "' + res["method"] + ' ' + res["uri"] + '"' if res['error']
|
@@ -85,7 +85,7 @@ module Apiary
|
|
85
85
|
|
86
86
|
resource.response = Apiary::Okapi::Response.new(response.code, raw_headers, response.body)
|
87
87
|
rescue Exception => e
|
88
|
-
raise Exception 'Can not get response for:' + params
|
88
|
+
raise Exception, 'Can not get response for: ' + params.to_json + ' (' + e.to_s + ')'
|
89
89
|
end
|
90
90
|
}
|
91
91
|
|
data/lib/okapi/version.rb
CHANGED
data/test_files/tests.spec
CHANGED
metadata
CHANGED