Sha256: ef74c17105c9b5a9c52ebe1bf0403c0eaab63897efafdc0192fda2810dbe498c

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require "spec_helper"

describe "Evaluating pool settings through dsl" do
  before :each do
    @dsl = Daemonizer::Dsl.evaluate(<<-EOF)
      poll_period 10

      pool "pool1" do
        workers 1

        not_cow_friendly
      end
      pool "pool2" do
        workers 2
        poll_period 2
      end
    EOF

    @configuration = @dsl.configs
  end

  it "should create 2 pool record" do
    @configuration.size.should == 2
  end

  it "should set parameters on pools isolated" do
    @configuration[:pool1].keys.should include(:workers, :poll_period, :cow_friendly)
    @configuration[:pool2].keys.should include(:workers, :poll_period)
    @configuration[:pool2].keys.should_not include(:cow_friendly)
  end

  it "should correctly inherit parameters from top level" do
    @configuration[:pool1][:poll_period].should == 10
    @configuration[:pool2][:poll_period].should == 2
  end

  it "should process pool definition on call Daemonizer::Dsl#process" do
    pool_config = Daemonizer::Config
    pool_config.expects(:new).with(:pool2, equals(@configuration[:pool2])).once
    pool_config.expects(:new).with(:pool1, equals(@configuration[:pool1])).once
    @processed_config = @dsl.process
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daemonizer-0.5.0.beta.1 spec/settings/pools_spec.rb