rocking_chair 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,7 +118,7 @@ module RockingChair
118
118
  filter_items_by_key([foreign_key_id(belongs_to)])
119
119
  filter_items_without_correct_ruby_class
120
120
  filter_deleted_items if options['without_deleted'].to_s == 'true'
121
- sort_by_attribute('_id')
121
+ sort_by_attribute('created_at')
122
122
  end
123
123
 
124
124
  def find_by_attribute(attribute_string)
@@ -118,11 +118,22 @@ class SimplyStoredTest < Test::Unit::TestCase
118
118
  assert_equal 3, @project.users.size
119
119
  assert_equal 2, @project.users(:limit => 2).size
120
120
  end
121
-
122
- should "support order" do
123
- 3.times{|i| User.create!(:firstname => "user #{i}", :project => @project) }
124
- assert_not_equal @project.users(:order => :asc).map(&:id), @project.users(:order => :desc).map(&:id)
125
- assert_equal @project.users(:order => :asc).reverse, @project.users(:order => :desc)
121
+
122
+ should "support mixing order and limit" do
123
+ michael = User.find(User.create!(:firstname => "michael", :project => @project).id)
124
+ michael.created_at = Time.local(2001)
125
+ michael.save!
126
+
127
+ mickey = User.find(User.create!(:firstname => "mickey", :project => @project).id)
128
+ mickey.created_at = Time.local(2002)
129
+ mickey.save!
130
+
131
+ mike = User.find(User.create!(:firstname => "mike", :project => @project).id)
132
+ mike.created_at = Time.local(2003)
133
+ mike.save!
134
+
135
+ assert_equal ["michael", "mickey", "mike"], @project.users(:order => :asc).map(&:firstname)
136
+ assert_equal ["michael", "mickey", "mike"].reverse, @project.users(:order => :desc).map(&:firstname)
126
137
  end
127
138
  end
128
139
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Weiss
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-21 00:00:00 +02:00
17
+ date: 2010-05-10 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency