Skip to content

Commit

Permalink
add update_indexed_attribute for setter delegation support in RdfReso…
Browse files Browse the repository at this point in the history
…urceDatastreams
  • Loading branch information
Tom Johnson committed Nov 24, 2013
1 parent 166c9f4 commit fe7b4ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/models/datastream/rdf_resource_datastream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def term_values(*values)
return current_value
end

def update_indexed_attributes(hash)
hash.each do |fields, value|
fields.each do |field|
self.send("#{field}=", value)
end
end
end

def rdf_subject
resource.subject
end
Expand Down
8 changes: 5 additions & 3 deletions spec/models/datastream/rdf_resource_datastream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ class DummyAsset < ActiveFedora::Base
end
end
describe "delegation" do
before(:each) do
it "should retrieve values" do
subject.descMetadata.title = "bla"
end
it "should work" do
expect(subject.title).to eq ["bla"]
end
it "should set values" do
subject.title = "blah"
expect(subject.descMetadata.title).to eq ["blah"]
end
end
describe "attribute setting" do
before(:each) do
Expand Down

0 comments on commit fe7b4ac

Please sign in to comment.