Ticket #7323: acts_as_list_tests_patch.diff
| File acts_as_list_tests_patch.diff, 2.3 kB (added by lonestarsoftware, 2 years ago) |
|---|
-
activerecord/test/mixin_test.rb
old new 82 82 83 83 end 84 84 85 def test_delete_all 86 assert_equal 4, ListMixinParent.find(5).list_mixins.count 87 ListMixinParent.find(5).list_mixins.delete_all 88 assert_equal 0, ListMixinParent.find(5).list_mixins.count 89 end 90 85 91 def test_move_to_bottom_with_next_to_last_item 86 92 assert_equal [mixins(:list_1), 87 93 mixins(:list_2), -
activerecord/test/fixtures/mixin.rb
old new 15 15 has_one :first_child, :class_name => 'RecursivelyCascadedTreeMixin', :foreign_key => :parent_id 16 16 end 17 17 18 class ListMixinParent < Mixin 19 has_many :list_mixins, :foreign_key => :parent_id 20 def self.table_name() "mixins" end 21 end 22 18 23 class ListMixin < Mixin 24 belongs_to :list_mixin_parent, :foreign_key => :parent_id 19 25 acts_as_list :column => "pos", :scope => :parent 20 21 26 def self.table_name() "mixins" end 22 27 end 23 28 -
activerecord/test/fixtures/mixins.yml
old new 60 60 parent_id: 5007 61 61 62 62 # List mixins 63 parent: 64 id: 5 65 type: ListMixinParent 66 parent_id: 63 67 64 <% (1..4).each do |counter| %>68 <% [4,2,3,1].each do |counter| %> 65 69 list_<%= counter %>: 66 70 id: <%= counter+1006 %> 67 71 pos: <%= counter %> … … 69 73 parent_id: 5 70 74 <% end %> 71 75 76 72 77 # Nested set mixins 73 78 74 79 <% (1..10).each do |counter| %> -
activerecord/test/fixtures/db_definitions/mysql.sql
old new 130 130 PRIMARY KEY (`id`) 131 131 ) TYPE=InnoDB; 132 132 133 ALTER TABLE mixins ADD UNIQUE INDEX (parent_id, pos); 134 133 135 CREATE TABLE `people` ( 134 136 `id` INTEGER NOT NULL auto_increment PRIMARY KEY, 135 137 `first_name` VARCHAR(40) NOT NULL,