Sha256: 19945017befdf9541ab140cdcaeddb668a19a11d6ccb60f67457cdce93961dca

Contents?: true

Size: 1.64 KB

Versions: 11

Compression:

Stored size: 1.64 KB

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

require 'tengine/event'

describe Tengine::Core::Config::Atd do

  describe :[] do
    it "should convert a Hash to a Tengine::Core::Config::Atd" do
      converted = Tengine::Core::Config::Atd[{:process => {:daemon => true}}]
      converted.should be_a(Tengine::Core::Config::Atd)
      converted[:process][:daemon].should be_true
    end

    it "should return same Tengine::Core::Config::Atd" do
      converted = Tengine::Core::Config::Atd.new(:process => {:daemon => true})
      Tengine::Core::Config::Atd[converted].should == converted
    end
  end

  context "デフォルト" do
    subject do
      Tengine::Core::Config::Atd.new
    end
    its(:db){ should == {
        'host' => 'localhost',
        'port' => 27017,
        'username' => nil,
        'password' => nil,
        'database' => 'tengine_production',
      }}

    it "db" do
      subject.db.should == {
        'host' => 'localhost',
        'port' => 27017,
        'username' => nil,
        'password' => nil,
        'database' => 'tengine_production',
      }
    end

    it "process_daemon" do
      subject[:process][:daemon].should be_false
    end

    it "heartbeat_atd" do
      subject[:heartbeat][:atd][:interval].should == 0
    end

  end

  context "指定した設定ファイルが存在しない場合" do
    it "例外を生成します" do
      config_path = File.expand_path("../config_spec/unexist_config.yml", File.dirname(__FILE__))
      expect{
        Tengine::Core::Config::Atd.new(:config => config_path)
      }.to raise_error(Tengine::Core::ConfigError, /No such file or directory - #{config_path}/)
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tengine_core-0.5.39 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.38 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.37 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.36 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.35 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.34 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.33 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.32 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.31 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.30 spec/tengine/core/config/atd_spec.rb
tengine_core-0.5.28 spec/tengine/core/config/atd_spec.rb