Sha256: 01708ddc24084265c9b4f34b0ab0bc09d22552225a9946a299c59961cf5380f9
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require 'opal/spec' require 'opal-sprockets' module Opal module Spec class RakeTask include Rake::DSL if defined? Rake::DSL RUNNER = File.expand_path('../../../../vendor/spec_runner.js', __FILE__) PORT = 9999 URL = "http://localhost:9999/" def initialize(name = 'opal:test', &block) desc "Run opal specs in phantomjs" task name do require 'rack' require 'webrick' server = fork do app = Opal::Server.new { |s| s.main = 'opal/spec/sprockets_runner' s.append_path 'spec' s.debug = false block.call s if block } Rack::Server.start(:app => app, :Port => PORT, :AccessLog => [], :Logger => WEBrick::Log.new("/dev/null")) end system "phantomjs #{RUNNER} \"#{URL}\"" success = $?.success? Process.kill(:SIGINT, server) Process.wait exit 1 unless success end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-spec-0.3.2 | lib/opal/spec/rake_task.rb |
opal-spec-0.3.1 | lib/opal/spec/rake_task.rb |
opal-spec-0.2.17 | lib/opal/spec/rake_task.rb |