diff options
| author | Stefan Daschek <[email protected]> | 2012-11-12 17:47:27 +0100 |
|---|---|---|
| committer | Stefan Daschek <[email protected]> | 2012-11-12 17:47:27 +0100 |
| commit | 2fa7e78e8e06758b68317b76d770a5673c93d99b (patch) | |
| tree | da710135051b155b065ce2b26387d2c84654e9c6 /test/rels/tc_relationship.rb | |
| parent | 49638e7b4120c22a9a90a6aa967f636a7056022e (diff) | |
| download | caxlsx-2fa7e78e8e06758b68317b76d770a5673c93d99b.tar.gz caxlsx-2fa7e78e8e06758b68317b76d770a5673c93d99b.zip | |
Escape URLs used as target for hyperlinks.
Up to now, when using an URL containing a & character, the generated XML was invalid.
Diffstat (limited to 'test/rels/tc_relationship.rb')
| -rw-r--r-- | test/rels/tc_relationship.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb index ef995449..32b9e4a1 100644 --- a/test/rels/tc_relationship.rb +++ b/test/rels/tc_relationship.rb @@ -18,4 +18,9 @@ class TestRelationships < Test::Unit::TestCase assert_nothing_raised { Axlsx::Relationship.new( Axlsx::WORKSHEET_R, 'target', :target_mode => :External) } end + def test_ampersand_escaping_in_target + r = Axlsx::Relationship.new(Axlsx::HYPERLINK_R, "http://example.com?foo=1&bar=2", :target_mod => :External) + doc = Nokogiri::XML(r.to_xml_string(1)) + assert_equal(doc.xpath("//Relationship[@Target='http://example.com?foo=1&bar=2']").size, 1) + end end |
