switest 0.4.0 → 0.5.0
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 +4 -4
- data/lib/switest/agent.rb +5 -6
- data/lib/switest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fdaefdf21fc869293a38179620ef8f3f03275d66dd4546ace3718435114f06eb
|
|
4
|
+
data.tar.gz: 4d0824c102a4c04799b5476cb46a50dfbdd56058a6c10247ac12eb399d32824e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a617e7e7fa1af4cb7b455826abc7826969490115cf7ee457287b2154ca6482dd0d3bdf12ab08bccc7f96bbee145e9f798f1c56e963972be2b331832fccc5448
|
|
7
|
+
data.tar.gz: ed0c82a56e79633bd888fa068ff565b9bf67031b149979a7c46d81c3be4dcd1f7f4b73d6fd4f178cace6fb772902ab0657c3a6cd0dd2c024d7c7cfc790c6b939
|
data/lib/switest/agent.rb
CHANGED
|
@@ -31,6 +31,7 @@ module Switest
|
|
|
31
31
|
# Register a one-time handler for matching inbound calls
|
|
32
32
|
@events.once(:offer, guards) do |data|
|
|
33
33
|
agent.instance_variable_set(:@call, data[:call])
|
|
34
|
+
agent.instance_variable_get(:@call_event).set
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
agent
|
|
@@ -41,6 +42,7 @@ module Switest
|
|
|
41
42
|
|
|
42
43
|
def initialize(call)
|
|
43
44
|
@call = call
|
|
45
|
+
@call_event = Concurrent::Event.new
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
def call?
|
|
@@ -78,12 +80,9 @@ module Switest
|
|
|
78
80
|
end
|
|
79
81
|
|
|
80
82
|
def wait_for_call(timeout: 5)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
sleep 0.1
|
|
85
|
-
end
|
|
86
|
-
false
|
|
83
|
+
return true if @call
|
|
84
|
+
@call_event.wait(timeout)
|
|
85
|
+
!@call.nil?
|
|
87
86
|
end
|
|
88
87
|
|
|
89
88
|
def wait_for_answer(timeout: 5)
|
data/lib/switest/version.rb
CHANGED