Sha256: d43663a6186cae2c7d5d67d170effa6bf47c04bbdb8029b91405e1727db30b45

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require File.join(File.dirname(__FILE__), *%w[helper])

context "File" do
  setup do
    @wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
    @path = testpath("examples/test_empty.git")
    FileUtils.rm_rf(@path)
    Grit::Repo.init_bare(@path)
    @wiki_empty = Gollum::Wiki.new(@path)
  end

  test "search file on empty git repo" do
    assert_nothing_raised do
      file_not_exist = @wiki_empty.file("not_exist.md")
      assert_nil file_not_exist
    end
  end

  test "new file" do
    file = Gollum::File.new(@wiki)
    assert_nil file.raw_data
  end

  test "existing file" do
    commit = @wiki.repo.commits.first
    file   = @wiki.file("Mordor/todo.txt")
    assert_equal "[ ] Write section on Ents\n", file.raw_data
    assert_equal 'todo.txt',         file.name
    assert_equal commit.id,          file.version.id
    assert_equal commit.author.name, file.version.author.name
  end

  test "accessing tree" do
    assert_nil @wiki.file("Mordor")
  end

  teardown do
    FileUtils.rm_r(File.join(File.dirname(__FILE__), *%w[examples test_empty.git]))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tecnh-gollum-1.0.2.auth2 test/test_file.rb
tecnh-gollum-1.0.2.auth test/test_file.rb