factor-connector-api 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/factor-connector-api/test.rb +54 -32
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGM1MTZiYjZjZDFjZDIzMDg0MzZiZTQxOWQwOWE4MGM4NmNlYTVhNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjRiZDRiZjg3YWMwMmQ3YTc2YzRlNDVjOWVkNDU5NzQ2ZWE3OGI2NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjMyZDU1NzBmNTgyZmY0NTRhNTRiODI2OTljMTY0MTQ1NTU3MzIwYzU0NTM5
|
10
|
+
NzY3MTkwNjYzNDcxNzAxYmYwYWQ1MWMzZDk2NjAzYmY5ZmU1MmY0ZGVkMTVh
|
11
|
+
ZGQyMDk2ZTE5YzgwNTc3YjU1YzZjNWI3MTkwYjEzMjQ1ZGE3YmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjBhZTg0NGM4NTJjMzYxZTI4MGU5ZjgyZTc4NTExZGM4ZjZkZDU1MGUwODlh
|
14
|
+
NGMwZGVhYTRiNWFkYWY4NmU5YjU2ZjBlN2QzYzlkMDgwNzBiZWZmMTc2NDU0
|
15
|
+
ZTBmYTFhYjY0NGMzNzQ3YmUwNzVmMGYzMzZiOWExY2JlZjdkNGU=
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rspec'
|
2
|
-
require 'wrong'
|
3
2
|
require_relative '../factor-connector-api.rb'
|
4
3
|
|
5
4
|
module Factor::Connector::Test
|
@@ -10,51 +9,74 @@ end
|
|
10
9
|
|
11
10
|
module Factor::Connector
|
12
11
|
class ServiceInstance
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
def eventually(&block)
|
13
|
+
found = false
|
14
|
+
timeout = 10
|
15
|
+
frequency = 4.0
|
16
|
+
pause = 1 / frequency
|
17
|
+
count = timeout * frequency
|
18
|
+
(0..count).each do |tick|
|
19
|
+
any = begin
|
20
|
+
block.call
|
21
|
+
rescue
|
22
|
+
false
|
19
23
|
end
|
24
|
+
|
25
|
+
if any
|
26
|
+
found = true
|
27
|
+
break
|
28
|
+
end
|
29
|
+
sleep pause
|
20
30
|
end
|
31
|
+
found
|
21
32
|
end
|
22
33
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
34
|
+
def expect_in_logs(expected_hash={})
|
35
|
+
match = {}
|
36
|
+
found = eventually do
|
37
|
+
any = @logs.any? do |actual_output|
|
38
|
+
all_equal = true
|
39
|
+
expected_hash.each_pair do |key, expected_value|
|
40
|
+
all_equal = false unless actual_output[key] == expected_value
|
41
|
+
end
|
42
|
+
match = actual_output if all_equal
|
43
|
+
all_equal
|
44
|
+
end
|
27
45
|
end
|
46
|
+
|
47
|
+
raise "No match found for #{expected_hash}. Last line was #{@logs.last}" unless found
|
48
|
+
match if found
|
49
|
+
end
|
50
|
+
|
51
|
+
def expect_return(expected_values={})
|
52
|
+
compares = { type: 'return' }
|
53
|
+
compares[:payload] = expected_values if expected_values && expected_values!={}
|
54
|
+
expect_in_logs compares
|
28
55
|
end
|
29
56
|
|
30
57
|
def expect_fail(options={})
|
31
|
-
|
32
|
-
assert { log[:type] == 'fail' }
|
33
|
-
end
|
58
|
+
expect_in_logs type: 'fail'
|
34
59
|
end
|
35
60
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
61
|
+
def expect_log(status,expected_values={})
|
62
|
+
compares = {
|
63
|
+
type:'log',
|
64
|
+
status:status
|
65
|
+
}
|
66
|
+
compares[:message] = expected_values[:message] if expected_values[:message]
|
67
|
+
expect_in_logs compares
|
42
68
|
end
|
43
69
|
|
44
|
-
def
|
45
|
-
|
46
|
-
assert { log[:type] == 'log' }
|
47
|
-
assert { log[:status] == 'warn' } if log[:type] == 'log'
|
48
|
-
assert { log[:message] == options[:message] } if options[:message] && log[:type]=='log' && log[:status]=='warn'
|
49
|
-
end
|
70
|
+
def expect_info(expected_values={})
|
71
|
+
expect_log('info',expected_values)
|
50
72
|
end
|
51
73
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
74
|
+
def expect_warn(expected_values={})
|
75
|
+
expect_log('info',expected_values)
|
76
|
+
end
|
77
|
+
|
78
|
+
def expect_error(expected_values={})
|
79
|
+
expect_log('error',expected_values)
|
58
80
|
end
|
59
81
|
|
60
82
|
def test_action(action_name, params={}, &block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factor-connector-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Skierkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|