@@ -18,27 +18,18 @@ class FOO < RDF::Vocabulary("http://foo/"); end
1818 context "typed resources" do
1919 context "resource without type" do
2020 subject do
21- @graph << [ RDF ::URI . new ( "http://release/" ) , RDF ::DC . title , "foo & bar " ]
21+ @graph << [ RDF ::URI . new ( "http://release/" ) , RDF ::DC . title , "foo" ]
2222 serialize ( attributes : :untyped )
2323 end
2424
2525 {
2626 "/rdf:RDF/rdf:Description/@rdf:about" => "http://release/" ,
27- "/rdf:RDF/rdf:Description[@dc:title='foo & bar']/@rdf:about" => "http://release/" ,
28- "/rdf:RDF/rdf:Description/@dc:title" => "foo & bar"
27+ "/rdf:RDF/rdf:Description/@dc:title" => "foo"
2928 } . each do |path , value |
3029 it "returns #{ value . inspect } for xpath #{ path } " do
3130 expect ( subject ) . to have_xpath ( path , value , { } , @debug )
3231 end
3332 end
34- [
35- '<dc:title>foo & bar</dc:title>' ,
36- 'dc:title=\'foo & bar\''
37- ] . each do |value |
38- it "serializes literal value with illegal XML characters to fragment #{ value } " do
39- expect ( subject ) . to include ( value )
40- end
41- end
4233 end
4334
4435 context "resource with type" do
@@ -119,7 +110,42 @@ class FOO < RDF::Vocabulary("http://foo/"); end
119110 end
120111 end
121112 end
122-
113+
114+ context "with illegal content" do
115+ context "in attribute" , skip : !defined? ( ::Nokogiri ) do
116+ subject do
117+ @graph << [ RDF ::URI . new ( "http://release/" ) , RDF ::DC . title , "foo & bar" ]
118+ serialize ( attributes : :untyped )
119+ end
120+
121+ {
122+ "/rdf:RDF/rdf:Description/@rdf:about" => "http://release/" ,
123+ "/rdf:RDF/rdf:Description/@dc:title" => "foo & bar" ,
124+ "/rdf:RDF/rdf:Description/dc:title" => false
125+ } . each do |path , value |
126+ it "returns #{ value . inspect } for xpath #{ path } " do
127+ expect ( subject ) . to have_xpath ( path , value , { } , @debug )
128+ end
129+ end
130+ end
131+ context "in element" do
132+ subject do
133+ @graph << [ RDF ::URI . new ( "http://release/" ) , RDF ::DC . title , "foo & bar" ]
134+ serialize ( attributes : :none )
135+ end
136+
137+ {
138+ "/rdf:RDF/rdf:Description/@rdf:about" => "http://release/" ,
139+ "/rdf:RDF/rdf:Description/@dc:title" => false ,
140+ "/rdf:RDF/rdf:Description/dc:title/text()" => "foo & bar"
141+ } . each do |path , value |
142+ it "returns #{ value . inspect } for xpath #{ path } " do
143+ expect ( subject ) . to have_xpath ( path , value , { } , @debug )
144+ end
145+ end
146+ end
147+ end
148+
123149 context "with children" do
124150 before ( :each ) {
125151 @graph << [ RDF ::URI . new ( "http://release/" ) , RDF . type , FOO . Release ]
0 commit comments