Sha256: ab029fe24e88735ecf8c097ab8e2954ede27f5ae32b97afdcd8b12d476f0d3b5

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8
#
# This file is part of the devdnsd gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
#

require "spec_helper"
require "tempfile"

describe DevDNSd::Configuration do
  describe "#initialize" do
    it "sets default arguments and rules" do
      config = DevDNSd::Configuration.new
      expect(config.address).to eq("0.0.0.0")
      expect(config.port).to eq(7771)
      expect(config.tld).to eq("dev")
      expect(config.log_file).to eq("/var/log/devdnsd.log")
      expect(config.log_level).to eq(::Logger::INFO)
      expect(config.rules.count).to eq(1)
      expect(config.foreground).to eq(false)
    end
  end

  describe "#add_rule" do
    it "should add a good rule" do
      config = DevDNSd::Configuration.new
      config.add_rule("RULE", "127.0.0.1")
      expect(config.rules.count).to eq(2)
    end

    it "should reject a bad rule" do
      config = DevDNSd::Configuration.new
      expect { config.add_rule("RULE") }.to raise_error(DevDNSd::Errors::InvalidRule)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
devdnsd-3.0.7 spec/devdnsd/configuration_spec.rb
devdnsd-3.0.6 spec/devdnsd/configuration_spec.rb
devdnsd-3.0.5 spec/devdnsd/configuration_spec.rb
devdnsd-3.0.4 spec/devdnsd/configuration_spec.rb
devdnsd-3.0.3 spec/devdnsd/configuration_spec.rb
devdnsd-3.0.2 spec/devdnsd/configuration_spec.rb
devdnsd-3.0.1 spec/devdnsd/configuration_spec.rb