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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 668f47d96a39226d2a51f223d591f5fb1803bc24
4
- data.tar.gz: 8814b865d404865e65b29723e9f06cb8de8bf9ad
3
+ metadata.gz: a5dc54e45b5f8ad26dc7fd81bfe6fb22f7d288e0
4
+ data.tar.gz: 9fca354069d71f858748e472519f38e0eb7801a3
5
5
  SHA512:
6
- metadata.gz: 1997b2f11d8849ef1a9f2afc96972f1d4b2996aafef73e9044231048aa8834a73d8798c522f6424f9a52f3156b5daba7f020be4145fac1ce7c1bb699ea585a9c
7
- data.tar.gz: 3874f4fb26b88828bc9a8158ceb015dd8fe6260cf5651b9960eee8cdb31ce7252df1c45de256cef58e242f67891e96833f9891d237ffccf6cfbe14a79e793f2e
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
- if page.has_css?('[data-listener]')
10
- page.all(:css, '[data-listener]').each do |el|
11
- messages = push_data.select{|msg| msg['channel'] == el[:'data-channel']}
12
- message = messages.last
13
- if message
14
- page.execute_script("foreign_office.channels_by_name['#{el[:'data-channel']}'].handleMessage(#{message.to_json});")
15
- end
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
@@ -1,3 +1,3 @@
1
1
  module ForeignOffice
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreign_office
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut