Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This way File can be the target of ActiveFedora::Associations::RDF
- Loading branch information
Showing
6 changed files
with
84 additions
and
27 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
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
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,42 @@ | ||
require 'spec_helper' | ||
|
||
describe ActiveFedora::Associations::RDF do | ||
let(:owner) { double } | ||
let(:reflection) { double(check_validity!: true) } | ||
let(:association) { described_class.new(owner, reflection) } | ||
|
||
describe "#filtering_required?" do | ||
before do | ||
class SpecialFile < ActiveFedora::File; end | ||
class SpecialObject < ActiveFedora::Base; end | ||
allow(reflection).to receive(:klass).and_return(klass) | ||
end | ||
|
||
after do | ||
Object.send(:remove_const, :SpecialFile) | ||
Object.send(:remove_const, :SpecialObject) | ||
end | ||
|
||
subject { association.send(:filtering_required?) } | ||
|
||
context "when the klass is ActiveFedora::Base" do | ||
let(:klass) { ActiveFedora::Base } | ||
it { is_expected.to be false } | ||
end | ||
|
||
context "when the klass is not ActiveFedora::Base" do | ||
let(:klass) { SpecialObject } | ||
it { is_expected.to be true } | ||
end | ||
|
||
context "when the klass is ActiveFedora::File" do | ||
let(:klass) { ActiveFedora::File } | ||
it { is_expected.to be false } | ||
end | ||
|
||
context "when the klass is a subklass of ActiveFedora::File" do | ||
let(:klass) { SpecialFile } | ||
it { is_expected.to be false } | ||
end | ||
end | ||
end |
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