Sha256: 05a7eef1b23af511fc9cb65e4865a864142a33c7bff7fcf21985c37d4e3937b4
Contents?: true
Size: 1021 Bytes
Versions: 59
Compression:
Stored size: 1021 Bytes
Contents
module ForeignOffice module Test module ClientExec def fetch_foreign_office_messages push_data = File.read(Rails.root + 'tmp/foreign_office_rspec_cache.json') push_data = push_data.split('IH_FO_MESSAGE_SEPARATOR') push_data.map!{|msg| JSON.parse msg} File.delete(Rails.root + 'tmp/foreign_office_rspec_cache.json') exec_listeners(page.all(:css, '[data-listener]', visible: false), push_data) exec_listeners(page.all(:css, '[data-listener]'), push_data) end def exec_listeners(listeners, push_data) listeners.each do |el| messages = push_data.select{|msg| msg['channel'] == el[:'data-channel']} message = messages.last if message page.execute_script("foreign_office.channels_by_name['#{el[:'data-channel']}'].handleMessage(#{message.to_json});") end end end end end end RSpec.configure do |config| config.include ForeignOffice::Test::ClientExec, type: :feature end
Version data entries
59 entries across 59 versions & 1 rubygems