-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #955 from psu-stewardship/gone
Allowing access to the gone? method from outside the object
- Loading branch information
Showing
2 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
describe ActiveFedora::Base do | ||
before(:all) do | ||
class ResurrectionModel < ActiveFedora::Base | ||
after_destroy :eradicate | ||
end | ||
end | ||
|
||
after(:all) do | ||
Object.send(:remove_const, :ResurrectionModel) | ||
end | ||
|
||
context "when an object is has already been deleted" do | ||
let(:ghost) do | ||
obj = described_class.create | ||
obj.destroy | ||
obj.id | ||
end | ||
it "is gone" do | ||
expect(described_class.gone?(ghost)).to be true | ||
end | ||
end | ||
|
||
context "when the id has never been used" do | ||
let(:id) { "abc123" } | ||
it "is not gone" do | ||
expect(described_class.gone?(id)).to be false | ||
end | ||
end | ||
|
||
context "when the id is in use" do | ||
let(:active) do | ||
obj = described_class.create | ||
obj.id | ||
end | ||
it "is not gone" do | ||
expect(described_class.gone?(active)).to be false | ||
end | ||
end | ||
end |