Sha256: 048cf32bed627d10736ed0eeb05952fa3b250ef7d6daec9d41e712186a702393
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
require 'helper' module Polygon class ContentLoaderTest < Test::Unit::TestCase include Helper def setup @loader = ContentLoader.new @loader.enable_all! end def test_load fixtures = Path.dir/:fixtures/:data assert_equal({"kind" => "yml"}, @loader.load(fixtures/"data.yml")) assert_equal({"kind" => "yaml"}, @loader.load(fixtures/"data.yaml")) assert_equal({"kind" => "json"}, @loader.load(fixtures/"data.json")) assert_equal({"kind" => "rb"}, @loader.load(fixtures/"data.rb")) assert_equal({"kind" => "ruby"}, @loader.load(fixtures/"data.ruby")) assert_equal({"kind" => "md", "content" => "This is the text"}, @loader.load(fixtures/"data.md")) assert_equal({"content" => "This is the text"}, @loader.load(fixtures/"text.md")) assert_raise(Errno::ENOENT){ @loader.load(fixtures/"no-such-one.yml") } assert_raise(RuntimeError, /Unable to load.*unrecognized extension/){ @loader.load(fixtures/"data.notarecognized") } end def test_extensions assert_equal [".yml", ".yaml", ".json", ".rb", ".ruby", ".md"], @loader.extensions end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
polygon-0.0.3 | test/test_content_loader.rb |
polygon-0.0.2 | test/test_content_loader.rb |
polygon-0.0.1 | test/test_content_loader.rb |