Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

Commit

Permalink
Makes :title accesible on Worthwhile::GenericFile so that the Title f…
Browse files Browse the repository at this point in the history
…ield on GenericFile create/update form actually gets applied to the GenericFile object

refs #34
  • Loading branch information
flyingzumwalt committed Nov 11, 2014
1 parent d56537e commit 946e4d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@
end

context "updating metadata" do
it "should be successful" do
it "should be successful and update attributes" do
post :update, id: generic_file, generic_file:
{title: 'new_title', tag: [''], permissions: { new_user_name: {'archivist1'=>'edit'}}}
expect(response).to redirect_to [:curation_concern, generic_file]
expect(assigns[:generic_file].title).to eq(['new_title'])
end

it "should go back to edit on an error" do
Expand Down
5 changes: 5 additions & 0 deletions spec/models/worthwhile/generic_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
subject.depositor = '[email protected]'
end

it "should update attributes" do
subject.attributes = {title:"My new Title"}
expect(subject.title).to eq(["My new Title"])
end

describe "to_solr" do
before do
subject.title = ['One Flew Over the Cuckoo\'s Nest']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ module GenericFileBase

attr_accessor :file

attr_accessible *(terms_for_display)

# make filename single-value (Sufia::GenericFile::Characterization makes it multivalue)
# has_attributes :filename, datastream: :characterization, multiple: false
def filename
Expand Down

0 comments on commit 946e4d4

Please sign in to comment.