Sha256: c78d132eb9abf07ba8bb6031e555b20dc4829b39f02e833d6030f45127ba7a04

Contents?: true

Size: 1.16 KB

Versions: 72

Compression:

Stored size: 1.16 KB

Contents

require '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

72 entries across 72 versions & 3 rubygems

Version Path
classiccms-0.3.7 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.6 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.5 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.4 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.3 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.2 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.1 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classiccms-0.3.0 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
spork-0.9.2 spec/spork/run_strategy/forking_spec.rb
classiccms-0.2.4.pre vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
spork-0.9.1 spec/spork/run_strategy/forking_spec.rb
spork-1.0.0rc3 spec/spork/run_strategy/forking_spec.rb
classicCMS-0.2.3 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classicCMS-0.2.2 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classicCMS-0.2.1 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classicCMS-0.2.0 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
classicCMS-0.1.2 vendor/bundle/gems/spork-0.9.0/spec/spork/run_strategy/forking_spec.rb
spork-1.0.0rc2 spec/spork/run_strategy/forking_spec.rb
spork-1.0.0rc2-x86-mswin32 spec/spork/run_strategy/forking_spec.rb
spork-1.0.0rc2-x86-mingw32 spec/spork/run_strategy/forking_spec.rb