Sha256: 0273ddd99f548d96d6dd882c1921d4ec116f3145f9fd6a189a66e7935a571d14

Contents?: true

Size: 1.66 KB

Versions: 8

Compression:

Stored size: 1.66 KB

Contents

require 'test_helper'

class InstitutionsTest < Test::Unit::TestCase
  def setup
    # Undo any instance variable settings.
    Institutions.send(:instance_variable_set, :@loadpaths, nil)
    assert_equal([Institutions::DEFAULT_LOADPATH], Institutions.loadpaths)
    Institutions.send(:instance_variable_set, :@filenames, nil)
    assert_equal([Institutions::DEFAULT_FILENAME], Institutions.filenames)
    Institutions.send(:instance_variable_set, :@institutions, nil)
    assert_nil(Institutions.send(:instance_variable_get, :@institutions))
  end
  
  def test_module
    assert_kind_of Module, Institutions
  end
  
  def test_path
    assert_equal [Institutions::DEFAULT_LOADPATH], Institutions.loadpaths
    Institutions.loadpaths << File.join("../config")
    assert_equal [Institutions::DEFAULT_LOADPATH, "../config"], Institutions.loadpaths
  end
  
  def test_institutions
    Institutions.loadpaths << File.join("test", "config")
    institutions = Institutions.institutions
  end
  
  def test_institutions_overwrite
    Institutions.loadpaths << File.join("test", "config")
    Institutions.filenames << "overwrite.yml"
    institutions = Institutions.institutions
    assert_equal "ns", institutions[:NS].views["dir"]
    assert_equal "ns tag", institutions[:NS].views["tag"]
  end
  
  def test_institutions_parents
    Institutions.loadpaths << File.join("test", "config")
    institutions = Institutions.institutions
    assert_equal "NYU Libraries", institutions[:NYU].name
  end
  
  def test_institutions_default_as_name
    Institutions.loadpaths << File.join("test", "config")
    institutions = Institutions.institutions
    assert institutions[:default].default
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
institutions-0.1.3 test/institutions_test.rb
institutions-0.1.2 test/institutions_test.rb
institutions-0.1.1 test/institutions_test.rb
institutions-0.1.0 test/institutions_test.rb
institutions-0.0.7 test/institutions_test.rb
institutions-0.0.6 test/institutions_test.rb
institutions-0.0.5 test/institutions_test.rb
institutions-0.0.4 test/institutions_test.rb