Skip to content

Commit

Permalink
Merge pull request #18 from UNC-Libraries/deleted-record-method_missi…
Browse files Browse the repository at this point in the history
…ng-fix

Fix deleted records not raising DeletedRecordError upon method_missing
  • Loading branch information
kspurgin authored May 29, 2019
2 parents daf4433 + 3c8f26a commit 488e4ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/sierra_postgres_utilities/data/records/deleted.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def deleted?
# We don't know whether it was a bib/item/other_record_type method
# being called on this deleted record, but we want to warn especially
# in case it was.
def method_missing
def method_missing(method_name, *arguments, &block)
raise DeletedRecordError, "Deleted record #{record_type_code}" \
"#{record_num} lacks methods associated with undeleted records."
end
Expand Down
2 changes: 1 addition & 1 deletion lib/sierra_postgres_utilities/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Sierra
VERSION = '0.3.0'.freeze
VERSION = '0.3.1'.freeze
end
10 changes: 10 additions & 0 deletions spec/data/record/deleted_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'spec_helper'

describe Sierra::Data::DeletedRecord do
let(:rec) { Sierra::Data::Metadata.first.extend Sierra::Data::DeletedRecord }

it 'raises a DeletedRecordError on method_missing' do
expect{ rec.non_existent_method }.
to raise_error(Sierra::Data::DeletedRecord::DeletedRecordError)
end
end

0 comments on commit 488e4ba

Please sign in to comment.