Sha256: 830f247aa81a3419995d4c3224200f83a6bfdb5a91b266d3f382024d7d3ce97a

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

require 'woodhouse'
require File.dirname(File.expand_path(__FILE__)) + '/shared_contexts'

describe Woodhouse::Server do
  it_should_behave_like "common"

  subject { Woodhouse::Server.new }

  it "should default to the :default node" do
    subject.node.should == :default
  end

  it "should expect the value to #layout= to be nil or a Layout" do
    subject.layout = Woodhouse::Layout.new
    subject.layout.should be_kind_of Woodhouse::Layout
    subject.layout = nil
    subject.layout.should be_nil
    if false # this craps out on JRuby
      begin
        oldlogger = Celluloid.logger
        Celluloid.logger = nil # It's going to crash
        expect do
          subject.layout = "foo"
        end.to raise_error
      ensure
        Celluloid.logger = oldlogger
      end
    end
  end

  it "should take a frozen clone of the layout" do
    layout = Woodhouse::Layout.new
    subject.layout = layout
    subject.layout.should_not be layout
    subject.layout.should be_frozen
  end

  context "#start" do
    
    it "should return false if a layout is not configured" do
      subject.start.should be_false
    end

    it "should return false if the set node doesn't exist in the layout" do
      subject.layout = populated_layout
      subject.node = :foo_bar_baz
      subject.start.should be_false
    end

    it "should return true and spin up workers if the node is valid" do
      subject.layout = populated_layout
      subject.start.should be_true
      # TODO: test for workers starting up
    end

  end

  context "#reload" do
    
    it "should shut down the server if a layout is not configured"

    it "should shut down the server if the set node doesn't exist in the layout"

    it "should shut down the server if the set node has no workers"

    it "should spin up new workers if they have been added to the node"

    it "should spin down workers if they have been removed from the node"

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
woodhouse-1.0.0 spec/server_spec.rb
woodhouse-0.1.5 spec/server_spec.rb
woodhouse-0.1.2 spec/server_spec.rb
woodhouse-0.1.1 spec/server_spec.rb