Sha256: 7e34b16c147dcbcb8d9c300e418744d137bac428e42c3cb597910531b80d5958

Contents?: true

Size: 1.52 KB

Versions: 22

Compression:

Stored size: 1.52 KB

Contents

require 'helper'

class Nanoc::Helpers::LinkToTest < Nanoc::TestCase
  include Nanoc::Helpers::LinkTo

  def test_examples_link_to
    # Parse
    YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')

    # Mock
    @items = [
      Nanoc::ItemRepView.new(mock, {}),
      Nanoc::ItemRepView.new(mock, {}),
      Nanoc::ItemRepView.new(mock, {}),
    ]
    @items[0].stubs(:identifier).returns('/about/')
    @items[0].stubs(:path).returns('/about.html')
    @items[1].stubs(:identifier).returns('/software/')
    @items[1].stubs(:path).returns('/software.html')
    @items[2].stubs(:identifier).returns('/software/nanoc/')
    @items[2].stubs(:path).returns('/software/nanoc.html')
    about_rep_vcard = Nanoc::ItemRepView.new(mock, {})
    about_rep_vcard.stubs(:path).returns('/about.vcf')
    @items[0].stubs(:rep).with(:vcard).returns(about_rep_vcard)

    # Run
    assert_examples_correct 'Nanoc::Helpers::LinkTo#link_to'
  end

  def test_examples_link_to_unless_current
    # Parse
    YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')

    # Mock
    @item_rep = mock
    @item_rep.stubs(:path).returns('/about/')
    @item = mock
    @item.stubs(:path).returns(@item_rep.path)

    # Run
    assert_examples_correct 'Nanoc::Helpers::LinkTo#link_to_unless_current'
  end

  def test_examples_relative_path_to
    # Parse
    YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')

    # Mock
    @item_rep = mock
    @item_rep.stubs(:path).returns('/foo/bar/')

    # Run
    assert_examples_correct 'Nanoc::Helpers::LinkTo#relative_path_to'
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
nanoc-4.7.9 test/helpers/test_link_to.rb
nanoc-4.7.8 test/helpers/test_link_to.rb
nanoc-4.7.7 test/helpers/test_link_to.rb
nanoc-4.7.6 test/helpers/test_link_to.rb
nanoc-4.7.5 test/helpers/test_link_to.rb
nanoc-4.7.4 test/helpers/test_link_to.rb
nanoc-4.7.3 test/helpers/test_link_to.rb
nanoc-4.7.2 test/helpers/test_link_to.rb
nanoc-4.7.1 test/helpers/test_link_to.rb
nanoc-4.7.0 test/helpers/test_link_to.rb
nanoc-4.6.4 test/helpers/test_link_to.rb
nanoc-4.6.3 test/helpers/test_link_to.rb
nanoc-4.6.2 test/helpers/test_link_to.rb
nanoc-4.6.1 test/helpers/test_link_to.rb
nanoc-4.6.0 test/helpers/test_link_to.rb
nanoc-4.5.4 test/helpers/test_link_to.rb
nanoc-4.5.3 test/helpers/test_link_to.rb
nanoc-4.5.2 test/helpers/test_link_to.rb
nanoc-4.5.1 test/helpers/test_link_to.rb
nanoc-4.5.0 test/helpers/test_link_to.rb