Skip to content

Commit

Permalink
cleanup, remove puts, add tests on direct query of child attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
simkim committed Nov 1, 2022
1 parent 8a4b9dd commit 8c7d3af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions spec/relation_nested_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class RelationParentModel < CouchbaseOrm::Base
NestedModel.new(name: "sub4", size: 4)
]
parent.save!
puts parent.as_json
puts RelationParentModel.where(subs: {size: {_gte: 3, _lt: 4}}).to_n1ql
expect(RelationParentModel.where(subs: {size: {_gte: 3, _lt: 4}}).first).to eq parent
end

Expand All @@ -56,10 +54,11 @@ class RelationParentModel < CouchbaseOrm::Base
parent = RelationParentModel.create(name: "parent")
parent.sub = NestedModel.new(name: "sub")
parent.save!

expect(RelationParentModel.where('sub.name': 'sub').first).to eq parent
expect(RelationParentModel.where(sub: {name: 'sub'}).first).to eq parent
expect(RelationParentModel.where(sub: {name: ['sub', 'subX']}).first).to eq parent
expect(RelationParentModel.where(sub: {name: ['subX']}).first).to be_nil

end

it "should query by grand child attribute" do
Expand Down
1 change: 0 additions & 1 deletion spec/type_nested_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ class WithValidationParent < CouchbaseOrm::Base
expect(obj).to_not be_valid
expect(obj.errors[:child]).to eq ["is invalid"]
expect(obj.child.errors[:name]).to eq ["can't be blank"]

end

it "should validate the nested objects in an array" do
Expand Down

0 comments on commit 8c7d3af

Please sign in to comment.