Sha256: c14589eff3ead96fb95fb5951f4bb7e50d8ea97cee0d5dfcb1c91ddcc2366466
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require 'test_helper' class MultipleScopedItemTest < ActiveSupport::TestCase def setup 16.times { |index| MultipleScopedItem.create :parent_id => index % 2, :tag => "tag_#{index % 4}"} @items = MultipleScopedItem.find(:all, :order => 'id', :conditions => {:parent_id => 1, :tag => 'tag_1'}) @ids = @items.map(&:id) end include SimpleTests include SimpleGaplessTests include ScopedTests def test_multiple_scopes_true_nil_scope item = multiple_create(nil, nil) assert item.in_list? assert item.first? assert item.last? assert_equal 1, item.list_position end protected def ordered_ids MultipleScopedItem.find(:all, :order => 'position', :conditions => "parent_id = 1 AND tag = 'tag_1' AND position IS NOT NULL").map(&:id) end def create(parent_id) MultipleScopedItem.create(:parent_id => parent_id, :tag => 'tag_1') end def multiple_create(parent_id, tag) MultipleScopedItem.create(:parent_id => parent_id, :tag => tag) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aguids-positionable-0.2.1 | test/rails_root/test/unit/multiple_scoped_item_test.rb |
aguids-positionable-0.2.2 | test/rails_root/test/unit/multiple_scoped_item_test.rb |