Sha256: 2c953213bed46d3e71a94d746aadae4bb7cc86d5efdcf42da59c263c7ecd8e54

Contents?: true

Size: 984 Bytes

Versions: 9

Compression:

Stored size: 984 Bytes

Contents

require 'hook-helpers'
require 'test_helper'

class LinkTest < Test::Unit::TestCase
  include HookHelpers

  def setup
    @basedir = HOOK_FILES_DIR
    create_temp_files
  end

  def teardown
    clean_temp_files
  end

  def test_link
    count = 3

    files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))[0..(count - 1)]

    # Link all files to last file
    hook('link', *files)

    assert_count_links(files[-1], count - 1, "Last file should have #{count - 1} links")
    # I think hook behavior with multi-file linking has changed...
    # assert_count_links(files[0], 1, 'First file should have 1 link')
  end

  def test_bi_link
    count = 3

    files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))[0..(count - 1)]

    # Link all files bi-directionally
    hook('link', '-a', *files)

    assert_count_links(files[-1], count - 1, "Last file should have #{count - 1} links")
    assert_count_links(files[0], count - 1, "First file should have #{count - 1} links")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hookapp-2.1.1 test/hook_link_test.rb
hookapp-2.1.0 test/hook_link_test.rb
hookapp-2.0.16 test/hook_link_test.rb
hookapp-2.0.15 test/hook_link_test.rb
hookapp-2.0.13 test/hook_link_test.rb
hookapp-2.0.12 test/hook_link_test.rb
hookapp-2.0.11 test/hook_link_test.rb
hookapp-2.0.10 test/hook_link_test.rb
hookapp-2.0.9 test/hook_link_test.rb