Sha256: 52f8ad73987e079a056802187e86965a60a58364119013ec7efc13a46f39d90d

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

require 'jasmine-phantom/server'
require 'phantomjs'

namespace :jasmine do
  namespace :phantom do
    desc "Run jasmine specs using phantomjs and report the results"
    task :ci => "jasmine:require" do
      require 'posix-spawn'
      require 'jasmine/version'

      if Jasmine::VERSION < "1.3.0"
        jasmine_config_overrides = File.join(Jasmine::Config.new.project_root, 'spec', 'javascripts' ,'support' ,'jasmine_config.rb')
        require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
      end

      port = Jasmine::Phantom::Server.start
      script = File.join File.dirname(__FILE__), 'run-jasmine.js'

      pid = POSIX::Spawn.spawn(Phantomjs.path, script, "http://localhost:#{port}")

      begin
        Thread.pass
        sleep 0.1
        wait_pid, status = Process.waitpid2 pid, Process::WNOHANG
      end while wait_pid.nil?
      exit(1) unless status.success?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jasmine-phantom-0.0.11 lib/jasmine-phantom/tasks.rake