Skip to content

Commit

Permalink
PostgreSQL sorts NULL values last so exclude them from the assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeltrix committed Jun 18, 2011
1 parent 379a4fe commit 3ef1d49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/sortifiable_test.rb
Expand Up @@ -172,7 +172,7 @@ def test_remove_from_list_should_set_position_to_nil

ListMixin.find(2).remove_from_list

assert_equal [2, 1, 3, 4], ListMixin.where(:parent_id => 5).map(&:id)
assert_equal [1, 3, 4], ListMixin.where(:parent_id => 5).where('pos IS NOT NULL').map(&:id)

assert_equal 1, ListMixin.find(1).pos
assert_equal nil, ListMixin.find(2).pos
Expand Down Expand Up @@ -707,7 +707,7 @@ def test_move_to_new_list_by_updating_scope_part_2_should_append
end

def test_move_to_new_list_by_updating_complete_scope_should_append
assert_equal [ 1, 2, 3, 4], ArrayScopeListMixin.where(conditions).map(&:id)
assert_equal [1, 2, 3, 4], ArrayScopeListMixin.where(conditions).map(&:id)
assert_equal [13, 14, 15, 16], ArrayScopeListMixin.where(:parent_id => 6, :parent_type => 'bananas').map(&:id)

ArrayScopeListMixin.find(2).update_attributes! :parent_id => 6, :parent_type => 'bananas'
Expand All @@ -734,7 +734,7 @@ def test_remove_from_list_should_set_position_to_nil

ArrayScopeListMixin.find(2).remove_from_list

assert_equal [2, 1, 3, 4], ArrayScopeListMixin.where(conditions).map(&:id)
assert_equal [1, 3, 4], ArrayScopeListMixin.where(conditions).where('pos IS NOT NULL').map(&:id)

assert_equal 1, ArrayScopeListMixin.find(1).pos
assert_equal nil, ArrayScopeListMixin.find(2).pos
Expand Down

0 comments on commit 3ef1d49

Please sign in to comment.