Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn when the same predicate is used in more than one property in the…
… same class
- Loading branch information
1 parent
bee58b8
commit 80d34ac
Showing
2 changed files
with
48 additions
and
1 deletion.
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,40 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Properties with the same predicate' do | ||
|
||
let(:warningMsg) {"Same predicate (http://purl.org/dc/terms/title) used for properties title1 and title2"} | ||
|
||
it "should warn" do | ||
|
||
# Note that the expect test must be before the class is parsed. | ||
expect(ActiveFedora::Base.logger).to receive(:warn).with(warningMsg) | ||
|
||
module TestModel1 | ||
class Book < ActiveFedora::Base | ||
property :title1, predicate: ::RDF::DC.title | ||
property :title2, predicate: ::RDF::DC.title | ||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
|
||
describe 'Properties with different predicate' do | ||
|
||
it "should not warn" do | ||
|
||
# Note that the expect test must be before the class is parsed. | ||
expect(ActiveFedora::Base.logger).to_not receive(:warn) | ||
|
||
module TestModel2 | ||
class Book < ActiveFedora::Base | ||
property :title1, predicate: ::RDF::DC.title | ||
property :title2, predicate: ::RDF::DC.creator | ||
end | ||
end | ||
|
||
end | ||
|
||
end |