|
64 | 64 | WebMock.stub_request(:get, uri).to_return(body: "foo", headers: {"Content-Type" => "text/turtle"}) |
65 | 65 | RDF::Util::File.open_file(uri) do |f| |
66 | 66 | expect(f.content_type).to eq "text/turtle" |
67 | | - expect(f.charset).to eq Encoding::UTF_8 |
68 | | - expect(f.content_encoding).to eq "utf-8" |
| 67 | + expect(f.charset).to eq "utf-8" |
69 | 68 | expect(f.external_encoding.to_s.downcase).to eq "utf-8" |
70 | 69 | opened.opened |
71 | 70 | end |
72 | 71 | end |
73 | 72 |
|
74 | | - it "sets content_type and encoding if provided" do |
75 | | - WebMock.stub_request(:get, uri).to_return(body: "foo", headers: {"Content-Type" => "text/turtle ; charset=ISO-8859-4"}) |
| 73 | + it "sets content_type and encoding if provided and UTF" do |
| 74 | + WebMock.stub_request(:get, uri).to_return(body: "foo".force_encoding("UTF-16"), headers: {"Content-Type" => "text/turtle ; charset=UTF-16"}) |
76 | 75 | RDF::Util::File.open_file(uri) do |f| |
77 | 76 | expect(f.content_type).to eq "text/turtle" |
78 | | - expect(f.charset).to eq "ISO-8859-4" |
79 | | - expect(f.external_encoding.to_s.downcase).to eq "iso-8859-4" |
| 77 | + expect(f.charset).to eq "utf-16" |
| 78 | + expect(f.external_encoding.to_s.downcase).to eq "utf-16" |
| 79 | + opened.opened |
| 80 | + end |
| 81 | + end |
| 82 | + |
| 83 | + it "sets content_type and encoding to UTF-8 if provided and not UTF" do |
| 84 | + WebMock.stub_request(:get, uri).to_return(body: "foo".force_encoding("ISO-8859-4"), headers: {"Content-Type" => "text/turtle ; charset=ISO-8859-4"}) |
| 85 | + RDF::Util::File.open_file(uri) do |f| |
| 86 | + expect(f.content_type).to eq "text/turtle" |
| 87 | + expect(f.charset).to eq "iso-8859-4" |
| 88 | + expect(f.external_encoding.to_s.downcase).to eq "utf-8" |
80 | 89 | opened.opened |
81 | 90 | end |
82 | 91 | end |
|
0 commit comments