Skip to content

Commit

Permalink
Allow #dup of Ldp::Response. Fixes #39
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jan 23, 2015
1 parent 52f5304 commit ff54d8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ldp/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def self.rdf_source? response
container?(response) || Array(links(response)["type"]).include?(Ldp.rdf_source)
end

def dup
super.tap do |new_resp|
new_resp.send(:extend, Ldp::Response)
end
end

##
# Link: headers from the HTTP response
def links
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/ldp/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
end
end

describe "#dup" do
let(:response) { Ldp::Response.wrap mock_client, mock_response }
subject { response.dup }
it { is_expected.to respond_to :links }
end


describe ".links" do
it "should extract link headers with relations as a hash" do
allow(mock_response).to receive(:headers).and_return(
Expand Down

0 comments on commit ff54d8e

Please sign in to comment.