Sha256: 1d50e1b7eeb318232b758ff94b6554c52658c5afe9f031eeaddd2f3b29d19503

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
institutions-0.0.2 test/institutions_test.rb