https://github.com/jekyll/jekyll
Raw File
Tip revision: cdeaa154cd147d0797281e9e1aab91bba9438403 authored by Parker Moore on 26 April 2014, 03:16:07 UTC
Release 2.0.0.rc1
Tip revision: cdeaa15
test_document.rb
require 'helper'

class TestDocument < Test::Unit::TestCase

  context "a document in a collection" do
    setup do
      @site = Site.new(Jekyll.configuration({
        "collections" => ["methods"],
        "source"      => source_dir,
        "destination" => dest_dir
      }))
      @site.process
      @document = @site.collections["methods"].docs.first
    end

    should "know its relative path" do
      assert_equal "_methods/configuration.md", @document.relative_path
    end

    should "knows its extname" do
      assert_equal ".md", @document.extname
    end

    should "know its basename" do
      assert_equal "configuration.md", @document.basename
    end

    should "allow the suffix to be specified for the basename" do
      assert_equal "configuration", @document.basename(".*")
    end

    should "know whether its a yaml file" do
      assert_equal false, @document.yaml_file?
    end

    should "know its data" do
      assert_equal({
        "title" => "Jekyll.configuration",
        "whatever" => "foo.bar"
      }, @document.data)
    end

  end

  context " a document part of a rendered collection" do
  end

end
back to top