Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f0a56853de
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (30 sloc) 0.758 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
require 'test_helper'

class RunnerTest < Test::Unit::TestCase
  def setup
    @config = Trample::Configuration.new do |t|
      t.concurrency 2
      t.iterations 5
    end
  end

  context "Running a trample" do
    setup do
      @runner = Trample::Runner.new(@config)
      @runner.trample
    end

    before_should "spawn <concurrency> threads" do
      mock.proxy(Thread).new(@config).times(2)
    end

    before_should "start <concurrency> sessions trampling" do
      stub.proxy(Trample::Session).new(@config).times(2) do |s|
        mock(s).trample
        s
      end
    end

    before_should "block until all the threads terminate" do
      stub.proxy(Thread).new(@config) do |t|
        mock(t).join
        t
      end
    end
  end
end
Something went wrong with that request. Please try again.