Sha256: 1bc4ee56e740a91f44003cfa27a560d80764c26e967d6e26a7100f75e86d7770

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

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

class ResourceManagerTest < Webgen::PluginTestCase

  plugin_files ['webgen/plugins/coreplugins/resourcemanager.rb']

  plugin_to_test 'Core/ResourceManager'

  def test_get_resource
    assert_not_nil( @plugin.get_resource( 'webgen-css' ) )
    assert_not_nil( @plugin.get_resource( 'webgen-javascript' ) )
  end

  def test_append_data
    data = 'testdata'
    @plugin.append_data( 'webgen-css', data )
    assert_equal( data, @plugin.get_resource( 'webgen-css' ).data )
    @plugin.append_data( 'invalid-resource', data )
  end

end

class ResourceTagTest < Webgen::TagTestCase

  plugin_files ['webgen/plugins/coreplugins/resourcemanager.rb']

  plugin_to_test 'Tag/Resource'

  def test_process_tag
    css = @manager['Core/ResourceManager'].get_resource( 'webgen-css' )
    node = Node.new( nil, 'out' )

    set_config( 'name' => 'webgen-css', 'insert' => :path )
    assert_equal( css.output_path, @plugin.process_tag( 'resource', [node] ) )

    css.append_data( 'testdata' )
    set_config( 'name' => 'webgen-css', 'insert' => :data )
    assert_equal( 'testdata', @plugin.process_tag( 'resource', [node] ) )
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

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