Sha256: 4a11e8c1d7ba172963b846e903949dbdd29ab66732ab9e122021c205b4a4b5cb

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

module Polonium
describe ServerRunner do
  before(:each) do
    @runner = Polonium::ServerRunner.new
    class << @runner
      public :start_server, :stop_server
    end
  end

  it "should initialize started? to be false" do
    @runner.started?.should ==  false
  end

  it "start method should start new thread and set started" do
    start_server_called = false
    (class << @runner; self; end).class_eval do
      define_method :start_server do; start_server_called = true; end
    end
    def @runner.stop_server; end
    mock_thread_class = "mock_thread_class"
    mock(mock_thread_class).start {|block| block.call}
    @runner.thread_class = mock_thread_class

    @runner.start
    start_server_called.should equal(true)
    @runner.started?.should equal(true)
  end

  it "stop method should set started? to false" do
    def @runner.stop_server; end
    @runner.instance_eval {@started = true}
    @runner.stop
    @runner.started?.should ==  false
  end

  it "start_server method should raise a NotImplementedError by default" do
    proc {@runner.start_server}.should raise_error(NotImplementedError)
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polonium-0.1.0 spec/polonium/selenium_server_runner_spec.rb
polonium-0.1.1 spec/polonium/server_runner_spec.rb