forked from mongodb/mongoid
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming to something fake and less offensive
- Loading branch information
Showing
19 changed files
with
120 additions
and
117 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
2 changes: 1 addition & 1 deletion
2
...oloid/associations/association_factory.rb → ...ngoid/associations/association_factory.rb
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Mongoloid | ||
module Mongoid | ||
module Associations | ||
class AssociationFactory | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...id/associations/belongs_to_association.rb → ...id/associations/belongs_to_association.rb
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Mongoloid | ||
module Mongoid | ||
module Associations | ||
class BelongsToAssociation | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...loid/associations/has_many_association.rb → ...goid/associations/has_many_association.rb
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Mongoloid | ||
module Mongoid | ||
module Associations | ||
class HasManyAssociation < DelegateClass(Array) | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...oloid/associations/has_one_association.rb → ...ngoid/associations/has_one_association.rb
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Mongoloid | ||
module Mongoid | ||
module Associations | ||
class HasOneAssociation | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Mongoloid | ||
module Mongoid | ||
class Paginator | ||
|
||
attr_reader :limit, :offset | ||
|
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
4 changes: 2 additions & 2 deletions
4
spec/integration/mongoloid/document_spec.rb → spec/integration/mongoid/document_spec.rb
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
48 changes: 48 additions & 0 deletions
48
spec/unit/mongoid/associations/association_factory_spec.rb
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,48 @@ | ||
require File.join(File.dirname(__FILE__), "/../../../spec_helper.rb") | ||
|
||
describe Mongoid::Associations::AssociationFactory do | ||
|
||
describe "#create" do | ||
|
||
before do | ||
@document = Person.new | ||
end | ||
|
||
context "when type is has_many" do | ||
|
||
it "returns a HasManyAssociationProxy" do | ||
association = Mongoid::Associations::AssociationFactory.create(:has_many, :addresses, @document) | ||
association.should be_a_kind_of(Mongoid::Associations::HasManyAssociation) | ||
end | ||
|
||
end | ||
|
||
context "when type is has_one" do | ||
|
||
it "returns a HashOneAssociationProxy" do | ||
association = Mongoid::Associations::AssociationFactory.create(:has_one, :name, @document) | ||
association.should be_a_kind_of(Mongoid::Associations::HasOneAssociation) | ||
end | ||
|
||
end | ||
|
||
context "when type is belongs_to" do | ||
|
||
it "returns a BelongsToAssociationProxy" do | ||
association = Mongoid::Associations::AssociationFactory.create(:belongs_to, :person, @document) | ||
association.should be_a_kind_of(Mongoid::Associations::BelongsToAssociation) | ||
end | ||
|
||
end | ||
|
||
context "when type is invalid" do | ||
|
||
it "should raise a InvalidAssociationError" do | ||
lambda { Mongoid::Associations::AssociationFactory.create(:something, :person, @document) }.should raise_error | ||
end | ||
|
||
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
Oops, something went wrong.