barthes 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/barthes/action.rb +4 -2
- data/lib/barthes/reporter/default.rb +13 -5
- data/lib/barthes/reporter/junit_xml.rb +1 -1
- data/lib/barthes/version.rb +1 -1
- metadata +1 -1
data/lib/barthes/action.rb
CHANGED
@@ -39,13 +39,15 @@ module Barthes
|
|
39
39
|
action['request'] = params
|
40
40
|
action['response'] = response = @client.action(params)
|
41
41
|
|
42
|
-
if action['expectations']
|
42
|
+
if action['expectations'] && !action['expectations'].empty?
|
43
43
|
action['expectations'].each do |expectation|
|
44
44
|
result = @client.compare(response, evaluate_params(expectation))
|
45
45
|
expectation.update(result)
|
46
46
|
end
|
47
|
-
if action['expectations'].all? {|e| e['result'] == true }
|
47
|
+
if !action['expectations'].all? {|e| e['result'] == true }
|
48
48
|
action['status'] = 'failure'
|
49
|
+
else
|
50
|
+
action['status'] = 'success'
|
49
51
|
end
|
50
52
|
else
|
51
53
|
action['status'] = 'success'
|
@@ -25,8 +25,16 @@ module Barthes
|
|
25
25
|
if Barthes::Config[:quiet] == 0 && Barthes::Config[:dryrun] == 0
|
26
26
|
puts indent scenarios.size + 1, "request:"
|
27
27
|
puts indent scenarios.size + 2, JSON.pretty_generate(action['request'])
|
28
|
-
|
29
|
-
|
28
|
+
if %w(success failure).include?(action['status'])
|
29
|
+
puts indent scenarios.size + 1, "response:"
|
30
|
+
puts indent scenarios.size + 2, JSON.pretty_generate(action['response'])
|
31
|
+
elsif action['status'] == 'error'
|
32
|
+
puts indent scenarios.size + 1, "error:"
|
33
|
+
puts indent scenarios.size + 2, "class: #{action['error']['class']}"
|
34
|
+
puts indent scenarios.size + 2, "message: #{action['error']['message']}"
|
35
|
+
puts indent scenarios.size + 2, "backtrace:"
|
36
|
+
puts indent scenarios.size + 3, action['error']['backtrace'].join("\n")
|
37
|
+
end
|
30
38
|
end
|
31
39
|
expectations = action['expectations'] || []
|
32
40
|
expectations.each do |expectation|
|
@@ -38,10 +46,10 @@ module Barthes
|
|
38
46
|
flag = ''
|
39
47
|
if Barthes::Config[:dryrun] > 0
|
40
48
|
flag = 'skipped'
|
41
|
-
elsif
|
42
|
-
flag = green {'
|
49
|
+
elsif action['status'] == 'success'
|
50
|
+
flag = green { action['status'] }
|
43
51
|
else
|
44
|
-
flag = red {'
|
52
|
+
flag = red { action['status'] }
|
45
53
|
end
|
46
54
|
puts indent(scenarios.size + 1, "result: #{flag}")
|
47
55
|
end
|
@@ -58,7 +58,7 @@ module Barthes
|
|
58
58
|
@xml.skipped
|
59
59
|
when 'failure'
|
60
60
|
failure = "failed expectations: \n"
|
61
|
-
expectations =
|
61
|
+
expectations = json.last['expectations'] || []
|
62
62
|
expectations.each do |expectation|
|
63
63
|
if expectation['result'] == false
|
64
64
|
failure += JSON.pretty_generate(expectation) + "\n"
|
data/lib/barthes/version.rb
CHANGED