kapnismology 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kapnismology/evaluation.rb +4 -0
- data/lib/kapnismology/evaluation_collection.rb +4 -0
- data/lib/kapnismology/result.rb +14 -3
- data/lib/kapnismology/smoke_test.rb +2 -0
- data/lib/kapnismology/smoke_test_response.rb +1 -0
- data/lib/kapnismology/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cdd88164310160ef407d2e58091fa887e8b06cd
|
4
|
+
data.tar.gz: a98c0e7f701a41b1ed83a5298f250150f655b86c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa5eb88c8dd3926e736a46104181d8476e77e0a70696675ae89e031566f00e7be9961a41c3b41b4c5587ca39cf0f13fe1ce2155c7ceb6841d5516322172f3d4f
|
7
|
+
data.tar.gz: a1defdc78278c650b7e7a36610b1fe82011e192fc77b7748fe6cc072c6401ff7ecbf0fe2ee7b67cc18f1e6ae7b3aaf4e7416bc9bce93dd895e4ea944f24c0473
|
data/lib/kapnismology/result.rb
CHANGED
@@ -3,15 +3,15 @@ module Kapnismology
|
|
3
3
|
# It is useful to be able to test if the object is of a correct result type.
|
4
4
|
# It also have methods to add information and serialize it.
|
5
5
|
class BaseResult
|
6
|
-
attr_reader :data, :message, :debug_messages
|
6
|
+
attr_reader :data, :message, :debug_messages, :duration
|
7
7
|
def to_hash
|
8
|
-
{ passed: passed?, data: @data, message: @message, debug_messages: @debug_messages }
|
8
|
+
{ passed: passed?, data: @data, message: @message, debug_messages: @debug_messages, duration: @duration }
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s(name)
|
12
12
|
<<-eos
|
13
13
|
#{format_passed(passed?)}: #{name}
|
14
|
-
#{format_debug_messages(@debug_messages)}#{Terminal.bold(@message)}
|
14
|
+
#{format_duration(@duration)}#{format_debug_messages(@debug_messages)}#{Terminal.bold(@message)}
|
15
15
|
#{@data}
|
16
16
|
eos
|
17
17
|
end
|
@@ -25,6 +25,10 @@ eos
|
|
25
25
|
!!@passed
|
26
26
|
end
|
27
27
|
|
28
|
+
def record_duration(start_time)
|
29
|
+
@duration = ((Time.now - start_time) * 1000).floor
|
30
|
+
end
|
31
|
+
|
28
32
|
private
|
29
33
|
|
30
34
|
def format_debug_messages(debug_messages)
|
@@ -38,6 +42,10 @@ eos
|
|
38
42
|
def format_passed(passed)
|
39
43
|
passed ? Terminal.green('passed') : Terminal.red('failed')
|
40
44
|
end
|
45
|
+
|
46
|
+
def format_duration(duration)
|
47
|
+
"duration: #{Terminal.bold(duration)} ms\n"
|
48
|
+
end
|
41
49
|
end
|
42
50
|
|
43
51
|
# This is the result of each smoke test.
|
@@ -54,6 +62,7 @@ eos
|
|
54
62
|
@data = data
|
55
63
|
@message = message
|
56
64
|
@debug_messages = []
|
65
|
+
@duration = 0
|
57
66
|
end
|
58
67
|
end
|
59
68
|
|
@@ -64,6 +73,7 @@ eos
|
|
64
73
|
@data = data
|
65
74
|
@message = message
|
66
75
|
@debug_messages = []
|
76
|
+
@duration = 0
|
67
77
|
end
|
68
78
|
|
69
79
|
def to_s(name)
|
@@ -97,6 +107,7 @@ eos
|
|
97
107
|
@data = data
|
98
108
|
@message = message
|
99
109
|
@debug_messages = []
|
110
|
+
@duration = 0
|
100
111
|
end
|
101
112
|
end
|
102
113
|
end
|
@@ -17,6 +17,7 @@ module Kapnismology
|
|
17
17
|
|
18
18
|
# Internally Kapnismology is calling this method. We are handling exceptions under the hood here
|
19
19
|
def __result__
|
20
|
+
start_time = Time.now
|
20
21
|
execution = Timeout::timeout(self.class.timeout) { result }
|
21
22
|
result_object = execution || Result.new(false, {}, 'This test has not returned any result')
|
22
23
|
unless result_object.class.ancestors.include?(BaseResult)
|
@@ -33,6 +34,7 @@ module Kapnismology
|
|
33
34
|
result_object = Result.new(false, { exception: e.class, message: e.message }, message)
|
34
35
|
ensure
|
35
36
|
@all_result_messages ||= []
|
37
|
+
result_object.record_duration(start_time)
|
36
38
|
return result_object.add_debug_messages(@all_result_messages)
|
37
39
|
end
|
38
40
|
|
data/lib/kapnismology/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kapnismology
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordi Polo Carres
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: timecop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.7'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.7'
|
153
167
|
description: Engine for smoke tests and base classes
|
154
168
|
email:
|
155
169
|
- mumismo@gmail.com
|