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 f8baef5
Show file tree
Hide file tree
Showing 3 changed files with 8 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
1 change: 1 addition & 0 deletions worthwhile-models/app/models/worthwhile/generic_file.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Worthwhile
class GenericFile < ActiveFedora::Base
include Worthwhile::GenericFileBase
attr_accessible :title
end
end

1 comment on commit f8baef5

@jcoyne
Copy link
Contributor

@jcoyne jcoyne commented on f8baef5 Nov 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.