Sha256: 5385e18da345a898235220203f4721ff900ea53525dbb04c60d47ab7446add37

Contents?: true

Size: 1.74 KB

Versions: 10

Compression:

Stored size: 1.74 KB

Contents

require "test_helper"

class ConfigurationTest < ActiveSupport::TestCase

  should "verify typus roles is loaded" do
    assert Typus::Configuration.respond_to?(:roles!)
    assert Typus::Configuration.roles!.is_a?(Hash)
  end

  should "verify typus config file is loaded" do
    assert Typus::Configuration.respond_to?(:config!)
    assert Typus::Configuration.config!.is_a?(Hash)
  end

  should "load configuration files from config broken" do
    Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/broken")
    assert_not_equal Hash.new, Typus::Configuration.roles!
    assert_not_equal Hash.new, Typus::Configuration.config!
  end

  should "load configuration files from config empty" do
    Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/empty")
    assert_equal Hash.new, Typus::Configuration.roles!
    assert_equal Hash.new, Typus::Configuration.config!
  end

  should "load configuration files from config ordered" do
    Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/ordered")
    expected = { "admin" => { "categories" => "read" } }
    assert_equal expected, Typus::Configuration.roles!
  end

  should "load configuration files from config unordered" do
    Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/unordered")
    expected = { "admin" => { "categories" => "read, update" } }
    assert_equal expected, Typus::Configuration.roles!
  end

  should "load configuration files from config default" do
    Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/default")
    assert_not_equal Hash.new, Typus::Configuration.roles!
    assert_not_equal Hash.new, Typus::Configuration.config!
    assert Typus.resources.empty?
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
typus-3.0.11 test/lib/typus/configuration_test.rb
typus-3.0.11.rc5 test/lib/typus/configuration_test.rb
typus-3.0.11.rc4 test/lib/typus/configuration_test.rb
typus-3.0.11.rc3 test/lib/typus/configuration_test.rb
typus-3.0.11.rc2 test/lib/typus/configuration_test.rb
typus-3.0.11.rc1 test/lib/typus/configuration_test.rb
typus-3.0.10 test/lib/typus/configuration_test.rb
typus-3.0.9 test/lib/typus/configuration_test.rb
typus-3.0.8 test/lib/typus/configuration_test.rb
typus-3.0.7 test/lib/typus/configuration_test.rb