Sha256: 9e9c20abec48af3f606f9a8c0bc57ef6fa6417ddffe23815e448066fc18082a7

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Spork::RunStrategy::Forking do
  before(:each) do
    @fake_framework = FakeFramework.new
    @run_strategy = Spork::RunStrategy::Forking.new(@fake_framework)

  end

  it "returns the result of the run_tests method from the forked child" do
    create_helper_file
    @fake_framework.stub!(:run_tests).and_return("tests were ran")
    @run_strategy.run("test", STDOUT, STDIN).should == "tests were ran"
  end

  it "aborts the current running thread when another run is started" do
    create_helper_file
    @fake_framework.wait_time = 0.25
    first_run = Thread.new { @run_strategy.run("test", STDOUT, STDIN).should == nil }
    sleep(0.05)
    @run_strategy.run("test", STDOUT, STDIN).should == true

    # wait for the first to finish
    first_run.join
  end

  it "can abort the current run" do
    create_helper_file
    @fake_framework.wait_time = 5
    started_at = Time.now
    first_run = Thread.new { @run_strategy.run("test", STDOUT, STDIN).should == true }
    sleep(0.05)
    @run_strategy.send(:abort)
    sleep(0.01) while @run_strategy.running?

    (Time.now - started_at).should < @fake_framework.wait_time
  end
end unless windows?

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
spork-0.9.0.rc8-x86-mswin32 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc8-x86-mingw32 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc8 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc7 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc6 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc5 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc4 spec/spork/run_strategy/forking_spec.rb
spork-0.9.0.rc3 spec/spork/run_strategy/forking_spec.rb
nimboids-spork-0.8.99 spec/spork/run_strategy/forking_spec.rb
nimboids-spork-0.9.0.rc2 spec/spork/run_strategy/forking_spec.rb
invo-sporknife-0.1.0.1 spec/spork/run_strategy/forking_spec.rb
invo-sporknife-0.1.0 spec/spork/run_strategy/forking_spec.rb
invo-sporknife-0.1.0.pre spec/spork/run_strategy/forking_spec.rb