Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Customized field #1

Merged
merged 1 commit into from

2 participants

@semaperepelitsa

I've noticed that custom position field is not tested at all and that there should be problems with calling order able method twice (on inclusion and manually). And I was right. Field and index are defined twice and in this case with different names. I don't need this functionality hence submitting just basic tests so that you're aware :-)

@pyromaniac
Owner

Oh, thank you. I've got the issue. Will fix it soon.

@pyromaniac pyromaniac merged commit 58f4de0 into pyromaniac:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 0 deletions.
  1. +16 −0 spec/mongoid/orderable_spec.rb
View
16 spec/mongoid/orderable_spec.rb
@@ -36,6 +36,12 @@ class EmbeddedOrderable
embedded_in :embeds_orderable
end
+ class CustomizedOrderable
+ include Mongoid::Document
+ include Mongoid::Orderable
+
+ orderable :column => :pos
+ end
describe SimpleOrderable do
before :each do
@@ -251,4 +257,14 @@ def positions
end
+ describe CustomizedOrderable do
+ it 'does not have default position field' do
+ CustomizedOrderable.fields.should_not have_key('position')
+ end
+
+ it 'should have custom pos field' do
+ CustomizedOrderable.fields.should have_key('pos')
+ end
+ end
+
end
Something went wrong with that request. Please try again.