class Snapdragon::CliApplication

Public Class Methods

new(options, paths) click to toggle source
# File lib/snapdragon/cli_application.rb, line 16
def initialize(options, paths)
  @suite = Snapdragon::Suite.new(options, paths)
end

Public Instance Methods

run() click to toggle source
# File lib/snapdragon/cli_application.rb, line 20
def run
  session = Capybara::Session.new(:poltergeist, Snapdragon::WebApplication.new(nil, @suite))
  if @suite.filtered?
    session.visit("/run?spec=#{@suite.spec_query_param}")
  else
    session.visit("/run")
  end
  session.find("#testscomplete")
  return 0
end
serve() click to toggle source
# File lib/snapdragon/cli_application.rb, line 31
def serve
  server = Capybara::Server.new(Snapdragon::WebApplication.new(nil, @suite), 9292)
  server.boot
  if @suite.filtered?
    Launchy.open("http://localhost:9292/run?spec=#{@suite.spec_query_param}")
  else
    Launchy.open('http://localhost:9292/run')
  end
  trap('SIGINT') { puts "Shutting down..."; exit 0 }
  sleep
end