Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return relation for .limit, fixes #352
Adds the .scope method to CollectionProxy so that you can chain relations such as .limit to a CollectionProxy.
- Loading branch information
1 parent
e79b12b
commit 9cf316b
Showing
3 changed files
with
45 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
describe ActiveFedora::Associations::CollectionProxy do | ||
|
||
before do | ||
class Book < ActiveFedora::Base | ||
end | ||
class Page < ActiveFedora::Base | ||
end | ||
end | ||
|
||
after do | ||
Object.send(:remove_const, :Page) | ||
Object.send(:remove_const, :Book) | ||
end | ||
|
||
describe "#spawn" do | ||
|
||
let(:reflection) { Book.create_reflection(:has_many, :pages, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book) } | ||
let(:association) { ActiveFedora::Associations::HasManyAssociation.new(Book.new, reflection ) } | ||
let(:proxy) { described_class.new(association) } | ||
|
||
subject { proxy.spawn } | ||
it { is_expected.to be_instance_of ActiveFedora::Relation } | ||
|
||
end | ||
|
||
end |