Sha256: ebab0e877459587a1614dc5545b6e2ebaa98264bea1521bf363d2858c33ff995

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

require 'test_helper'

class XmlhasherTest < Test::Unit::TestCase

  def test_configure_settings_all_on
    configurable = XmlHasher.configure do |config|
      config.snakecase = true
      config.ignore_namespaces = true
      config.string_keys = true
    end
    assert_equal true, configurable.instance_variable_get(:'@snakecase')
    assert_equal true, configurable.instance_variable_get(:'@ignore_namespaces')
    assert_equal true, configurable.instance_variable_get(:'@string_keys')
  end

  def test_configure_settings_all_off
    configurable = XmlHasher.configure do |config|
      config.snakecase = false
      config.ignore_namespaces = false
      config.string_keys = false
    end
    assert_equal false, configurable.instance_variable_get(:'@snakecase')
    assert_equal false, configurable.instance_variable_get(:'@ignore_namespaces')
    assert_equal false, configurable.instance_variable_get(:'@string_keys')
  end

  def test_parser
    parser = XmlHasher.parser
    assert_equal XmlHasher::Parser, parser.class
    result = parser.parse(fixture('institution.xml').read)
    assert_not_empty result
    assert_equal Hash, result.class
  end

  def test_parse
    result = XmlHasher.parse(fixture('institution.xml').read)
    assert_not_empty result
    assert_equal Hash, result.class
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
xmlhasher_with_attributes-1.0.1 test/xmlhasher/xmlhasher_test.rb
xmlhasher_with_attributes-1.0.0 test/xmlhasher/xmlhasher_test.rb
xmlhasher-1.0.4 test/xmlhasher/xmlhasher_test.rb
xmlhasher-1.0.3 test/xmlhasher/xmlhasher_test.rb
xmlhasher-1.0.2 test/xmlhasher/xmlhasher_test.rb
xmlhasher-1.0.1 test/xmlhasher/xmlhasher_test.rb
xmlhasher-1.0.0 test/xmlhasher/xmlhasher_test.rb
xmlhasher-0.0.6 test/xmlhasher/xmlhasher_test.rb