Sha256: 243024d6222e35909c03efdd5b94916c8ac7aae34c6bd43c39b954f91bdc5d5b

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'test_helper')

module TaliaCore
  
  # Test the ActiveSource
  class SourceReaderTest < Test::Unit::TestCase

    suppress_fixtures
    
    def setup
      @test_xml = "<sources><source><attribute><predicate>uri\n</predicate>\n<value>http://foodonga.com</value></attribute><attribute><predicate>http://bongobongo.com</predicate><value>foo\n</value><value> bar</value><object>http:/bingobongo.com</object></attribute></source></sources>"
      @sources = ActiveSourceParts::Xml::SourceReader.sources_from(@test_xml)
    end
    
    def test_sources
      assert_equal(1, @sources.size)
    end
    
    def test_attributes
      assert_kind_of(Hash, @sources.first)
    end
    
    def test_uri
      assert_equal('http://foodonga.com', @sources.first['uri'])
    end
    
    def test_predicate
      assert_equal(['foo', 'bar', '<http:/bingobongo.com>'], @sources.first['http://bongobongo.com'])
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
talia_core-0.4.3 test/talia_core/source_reader_test.rb
talia_core-0.4.2 test/talia_core/source_reader_test.rb
talia_core-0.4.1 test/talia_core/source_reader_test.rb
talia_core-0.4.0 test/talia_core/source_reader_test.rb