Sha256: 206638bcca962483269bb62f32e65325506fc768385a3f148a9c7a71528a8896

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

require 'test/unit'
require 'helper'
require 'webgen/contentprocessor/context'

class TestContentProcessorContext < Test::Unit::TestCase

  def setup
    @context = Webgen::ContentProcessor::Context.new(:content => 'test', :key => :value, :chain => [:first, :last])
  end

  def test_initialize
    context = Webgen::ContentProcessor::Context.new
    assert_equal('', context.content)
    assert_kind_of(Webgen::ContentProcessor::AccessHash, context[:processors])
  end

  def test_clone
    other = @context.clone(:content => 'new', :key => :other)
    assert_equal('new', other.content)
    assert_equal(:other, other[:key])
    assert_equal([:first, :last], other[:chain])
  end

  def test_accessors
    assert_equal(:value, @context[:key])
    assert_equal([:first, :last], @context[:chain])
    assert_equal('test', @context.content)
    assert_equal(:first, @context.ref_node)
    assert_equal(:last, @context.content_node)
    assert_equal(:value, @context[:key])
    @context[:key] = :newvalue
    assert_equal(:newvalue, @context[:key])
    assert_equal(:last, @context.dest_node)
    @context[:dest_node] = :other
    assert_equal(:other, @context.dest_node)
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.4.20080929 test/test_contentprocessor_context.rb
gettalong-webgen-0.5.5.20081001 test/test_contentprocessor_context.rb
webgen-0.5.0 test/test_contentprocessor_context.rb
webgen-0.5.3 test/test_contentprocessor_context.rb
webgen-0.5.2 test/test_contentprocessor_context.rb
webgen-0.5.4 test/test_contentprocessor_context.rb
webgen-0.5.1 test/test_contentprocessor_context.rb
webgen-0.5.5 test/test_contentprocessor_context.rb