Sha256: e1e460a74ac0788d1c0d9ac6fa2b954a7b031b87faec444839d7c0e79261074f

Contents?: true

Size: 758 Bytes

Versions: 79

Compression:

Stored size: 758 Bytes

Contents

require 'test_helper'

describe "Crack::Util.to_xml_attributes" do
  before do
    @hash = { :one => "ONE", "two" => "TWO", :three => "it \"should\" work" }
  end

  it "turn the hash into xml attributes" do
    attrs = Crack::Util.to_xml_attributes(@hash)
    attrs.must_match /one="ONE"/m
    attrs.must_match /two="TWO"/m
    attrs.must_match /three="it "should" work"/m
  end

  it "preserve _ in hash keys" do
    attrs = Crack::Util.to_xml_attributes({
      :some_long_attribute => "with short value",
      :crash               => :burn,
      :merb                => "uses extlib"
    })

    attrs.must_match /some_long_attribute="with short value"/
    attrs.must_match /merb="uses extlib"/
    attrs.must_match /crash="burn"/
  end
end

Version data entries

79 entries across 71 versions & 13 rubygems

Version Path
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.51.22 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/crack-0.4.3/test/hash_test.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.49.94 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.49.21 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb
cloudsmith-api-0.49.15 vendor/bundle/ruby/2.6.0/gems/crack-0.4.3/test/hash_test.rb