Sha256: a1e93888fce37e7b130677fd52efc5047d6dd5b9362f9d266086b02723d2bb1e

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

require 'webgen/test'
require 'webgen/node'

class DownloadTagTest < Webgen::TagTestCase

  plugin_files [
    'webgen/plugins/tags/download.rb',
    'webgen/plugins/filehandlers/directory.rb',
    'webgen/plugins/filehandlers/copy.rb',
  ]
  plugin_to_test 'Tag/Download'


  def test_process_tag
    root = @manager['Core/FileHandler'].instance_eval { build_tree }
    node = root.resolve_node( 'test.jpg' )

    assert_equal( '', @plugin.process_tag( 'sitemap', [node] ) )

    set_config( 'url' => 'test.jpg' )
    assert_equal( '<img class="webgen-file-icon" src="{resource: webgen-icons-image}" alt="File icon" />' +
                  '<a href="test.jpg">test.jpg</a> (5 Byte)',
                  @plugin.process_tag( 'sitemap', [node, node] ) )

    set_config( 'url' => 'test.jpg', 'alwaysShowDownloadIcon' => true )
    assert_equal( @plugin.instance_eval { download_icon } +
                  '<img class="webgen-file-icon" src="{resource: webgen-icons-image}" alt="File icon" />' +
                  '<a href="test.jpg">test.jpg</a> (5 Byte)',
                  @plugin.process_tag( 'sitemap', [node, node] ) )
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
webgen-0.4.2 test/unittests/tc_tags_download.rb
webgen-0.4.0 test/unittests/tc_tags_download.rb
webgen-0.4.1 test/unittests/tc_tags_download.rb
webgen-0.4.5 test/unittests/tc_tags_download.rb
webgen-0.4.4 test/unittests/tc_tags_download.rb
webgen-0.4.3 test/unittests/tc_tags_download.rb
webgen-0.4.7 test/unittests/tc_tags_download.rb
webgen-0.4.6 test/unittests/tc_tags_download.rb