Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Commit

Permalink
Adds local_id instance method to SolrDocument
Browse files Browse the repository at this point in the history
Closes #207
  • Loading branch information
dchandekstark committed Apr 22, 2015
1 parent 64641a0 commit 3d8ee9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ddr/models/solr_document.rb
Expand Up @@ -18,6 +18,10 @@ def safe_id
id.sub(/:/, "-")
end

def local_id
get(Ddr::IndexFields::LOCAL_ID)
end

def active_fedora_model
get(Ddr::IndexFields::ACTIVE_FEDORA_MODEL)
end
Expand Down
5 changes: 5 additions & 0 deletions spec/models/solr_document_spec.rb
Expand Up @@ -51,6 +51,11 @@
end
end

describe "#local_id" do
before { subject[Ddr::IndexFields::LOCAL_ID] = "abcdef" }
its(:local_id) { is_expected.to eq("abcdef") }
end

describe "roles" do
before do
subject[Ddr::IndexFields::ACCESS_ROLE] = "[{\"type\":\"Editor\",\"scope\":\"policy\",\"agent\":\"Editors\"},{\"type\":\"Contributor\",\"scope\":\"resource\",\"agent\":\"bob@example.com\"}]"
Expand Down

0 comments on commit 3d8ee9b

Please sign in to comment.