foreign_office 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/foreign_office/test/client_exec.rb +12 -7
- data/lib/foreign_office/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5dc54e45b5f8ad26dc7fd81bfe6fb22f7d288e0
|
4
|
+
data.tar.gz: 9fca354069d71f858748e472519f38e0eb7801a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7b8c668c82b18e387b7854051b238c9ae15eb31d83e079dcffc4ed712fd706dbb4bab459d99900f852ceb5cdda449e808c63dad1b69428aecd46bb4839412a7
|
7
|
+
data.tar.gz: 5e02f7f7e9801f21598fffe41a71207666cf289080eb759998dcf1736998a59e3ec1830edffbf107ab246521bc0e8d9e09a6f49d9a1e3387f6c7a872af87af59
|
@@ -1,18 +1,23 @@
|
|
1
1
|
module ForeignOffice
|
2
2
|
module Test
|
3
3
|
module ClientExec
|
4
|
+
|
4
5
|
def fetch_foreign_office_messages
|
5
6
|
push_data = File.read(Rails.root + 'tmp/foreign_office_rspec_cache.json')
|
6
7
|
push_data = push_data.split('IH_FO_MESSAGE_SEPARATOR')
|
7
8
|
push_data.map!{|msg| JSON.parse msg}
|
8
9
|
File.delete(Rails.root + 'tmp/foreign_office_rspec_cache.json')
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
|
11
|
+
exec_listeners(page.all(:css, '[data-listener]', visible: false), push_data)
|
12
|
+
exec_listeners(page.all(:css, '[data-listener]'), push_data)
|
13
|
+
end
|
14
|
+
|
15
|
+
def exec_listeners(listeners, push_data)
|
16
|
+
listeners.each do |el|
|
17
|
+
messages = push_data.select{|msg| msg['channel'] == el[:'data-channel']}
|
18
|
+
message = messages.last
|
19
|
+
if message
|
20
|
+
page.execute_script("foreign_office.channels_by_name['#{el[:'data-channel']}'].handleMessage(#{message.to_json});")
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|