Sha256: 5eb2628c499bf7dfbf018274156ac5aaa4af8da8b5b6d0b26bcf98882b818b66

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require "rubygems"
require "spec"

dir = File.dirname(__FILE__)
$LOAD_PATH.unshift "#{dir}/../../lib"
require "js_spec"
require "hpricot"
require "lsof"

Spec::Runner.configure do |config|
  config.mock_with :rr
end

Thin::Logging.silent = false
Thin::Logging.debug = true

module WaitFor
  extend self
  def wait_for(time=5)
    Timeout.timeout(time) do
      loop do
        value = yield
        return value if value
      end
    end
  end
end

module Spec::Example::ExampleMethods
  include WaitFor
  attr_reader :spec_root_path, :implementation_root_path, :public_path
  before(:all) do
    dir = File.dirname(__FILE__)
    @spec_root_path = "#{dir}/../example_specs"
    @public_path = "#{dir}/../example_public"
    @implementation_root_path = "#{public_path}/javascripts"
    unless $js_spec_server_started
      Thread.start do
        JsSpec::Server.run(spec_root_path, implementation_root_path, public_path)
      end
      $js_spec_server_started = true
    end
    wait_for do
      Lsof.running?(8080)
    end
  end

  def root_url
    "http://#{JsSpec::DEFAULT_HOST}:#{JsSpec::DEFAULT_PORT}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
js_spec-0.3.2 spec/integration/integration_spec_helper.rb
js_spec-0.3.0 spec/integration/integration_spec_helper.rb
js_spec-0.3.1 spec/integration/integration_spec_helper.rb