|
13 | 13 |
|
14 | 14 | it "returns Net::HTTP if rest-client is not available" do |
15 | 15 | hide_const("RestClient") |
16 | | - RDF::Util::File.remove_instance_variable(:@http_adapter) |
| 16 | + RDF::Util::File.remove_instance_variable(:@http_adapter) if RDF::Util::File.instance_variable_defined?(:@http_adapter) |
17 | 17 | RDF::Util::File.http_adapter |
18 | 18 | expect(RDF::Util::File.http_adapter).to eq RDF::Util::File::NetHttpAdapter |
19 | 19 | end |
|
152 | 152 | end |
153 | 153 | end |
154 | 154 |
|
| 155 | + describe RDF::Util::File::RemoteDocument do |
| 156 | + subject { |
| 157 | + described_class.new("body", |
| 158 | + headers: { |
| 159 | + content_type: %(text/turtle ; charset=UTF-8 ; foo="a B c"), |
| 160 | + last_modified: "Thu, 24 Oct 2013 23:46:56 GMT", |
| 161 | + etag: "abc123", |
| 162 | + location: "http://location.example.org/", |
| 163 | + content_encoding: "gzip, identity", |
| 164 | + link: %(<http://example.com/foo>; rel="self"), |
| 165 | + }, |
| 166 | + base_uri: "http://base.example.org/", |
| 167 | + code: 200 |
| 168 | + ) |
| 169 | + } |
| 170 | + |
| 171 | + its(:read) {is_expected.to eq "body"} |
| 172 | + its(:base_uri) {is_expected.to eq "http://base.example.org/"} |
| 173 | + its(:content_type) {is_expected.to eq "text/turtle"} |
| 174 | + its(:charset) {is_expected.to eq "utf-8"} |
| 175 | + its(:code) {is_expected.to eq 200} |
| 176 | + its(:etag) {is_expected.to eq "abc123"} |
| 177 | + its(:parameters) {is_expected.to eq({charset: "UTF-8", foo: "a B c"})} |
| 178 | + its(:last_modified) {is_expected.to eq DateTime.parse("Thu, 24 Oct 2013 23:46:56 GMT")} |
| 179 | + its(:content_encoding) {is_expected.to eq %w(gzip identity)} |
| 180 | + its(:links) {expect(subject.links.to_a).to eq [["http://example.com/foo", [%w(rel self)]]]} |
| 181 | + end |
| 182 | + |
155 | 183 | context "HTTP Adapters" do |
156 | 184 | require 'rdf/spec/http_adapter' |
157 | 185 |
|
|
0 commit comments