class RSpec::Ui::NgrokHook

Constants

ConfigFile

Public Class Methods

shutdown() click to toggle source
# File lib/rspec/ui/ngrok_hook.rb, line 31
def self.shutdown
  # TODO
end
update_browser_army(subdomain) click to toggle source
# File lib/rspec/ui/ngrok_hook.rb, line 35
def self.update_browser_army(subdomain)
  HTTParty.patch("https://#{UxSpec.configuration.uxspec_uri}/#{UxSpec.configuration.token}.json", body: { project: { ngrok_id: subdomain, ngrok_port: @@current_port }}).body
end
update_port(port) click to toggle source
# File lib/rspec/ui/ngrok_hook.rb, line 12
def self.update_port(port)
  return if @@current_port == port
  shutdown

  tunnel = Locoyo::Tunnel.new(
    port:      port,
    address:  '127.0.0.1',
    protocol: 'http'
  )
  tunnel.run

  sleep(3)
  subdomain = tunnel.get_subdomain
  update_browser_army(subdomain)

  puts "View on http://uxspec.com/#{UxSpec.configuration.token}"
  @@current_port = port
end