acts_as_list 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c9b9604fc6198654f18e08d86d1d9b036fa2430
4
- data.tar.gz: 9a3bd7ece52927226cfdd073f9071525189f0f07
3
+ metadata.gz: a9a0291b66db99525acb7519c4f07f6213807fab
4
+ data.tar.gz: 2bd62327801108c1b2e352b60334457a2c61f5ec
5
5
  SHA512:
6
- metadata.gz: e9ba06d872a758fc9a0f7e32cb7439b6db5f59742a6c0b407a8be43915309f84df7e4c740ca56f0be99e78937bfb1522104ee6a90b025598497c952eaeba3e52
7
- data.tar.gz: 14581f4471d860d9619e9a84a1762b785f83b3d1b4856dfd1439ff72f680a73000ab68f87fb1e9b9629394f49d730e26d447b67af474d4e0f085b6f5642b0903
6
+ metadata.gz: 712b360a8fd332f72fd8ecc3df598f0bdc42d048a14c2662e26f0001af55dbb0c75848cfec246ac2f446eaff3152d7007fc5b7234464b27d4cebda202223e44e
7
+ data.tar.gz: cc181d9cd3b8644796aebe0ce6e09ebf166fc89970c5617bd56c968a19ac18c3c97f5e8a60d78ac39011b74ab9e09804414844eb18e191052bb3bc9f8a082adb
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.9.14](https://github.com/swanandp/acts_as_list/tree/v0.9.14) (2018-06-05)
4
+ [Full Changelog](https://github.com/swanandp/acts_as_list/compare/v0.9.13...v0.9.14)
5
+
6
+ **Closed issues:**
7
+
8
+ - `insert\_at` saves invalid ActiveRecord objects [\#311](https://github.com/swanandp/acts_as_list/issues/311)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - \#311 Don't insert invalid ActiveRecord objects [\#312](https://github.com/swanandp/acts_as_list/pull/312) ([seanabrahams](https://github.com/seanabrahams))
13
+
3
14
  ## [v0.9.13](https://github.com/swanandp/acts_as_list/tree/v0.9.13) (2018-06-05)
4
15
  [Full Changelog](https://github.com/swanandp/acts_as_list/compare/v0.9.12...v0.9.13)
5
16
 
@@ -96,7 +96,7 @@ module ActiveRecord
96
96
  end
97
97
 
98
98
  def applied_to?(klass)
99
- extracted_klasses.any? { |k| k == klass }
99
+ !(klass.ancestors & extracted_klasses).empty?
100
100
  end
101
101
 
102
102
  private
@@ -3,7 +3,7 @@
3
3
  module ActiveRecord
4
4
  module Acts
5
5
  module List
6
- VERSION = '0.9.14'
6
+ VERSION = '0.9.15'
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'helper'
4
+
5
+ class TodoItem < ActiveRecord::Base
6
+ acts_as_list
7
+ end
8
+
9
+ class SubTodoItem < TodoItem; end
10
+
11
+ class NoUpdateForSubclassesTestCase < Minitest::Test
12
+ def setup
13
+ ActiveRecord::Base.connection.create_table :todo_items do |t|
14
+ t.column :position, :integer
15
+ t.column :type, :string
16
+ end
17
+
18
+ ActiveRecord::Base.connection.schema_cache.clear!
19
+ [TodoItem, SubTodoItem].each(&:reset_column_information)
20
+ super
21
+ end
22
+
23
+ def teardown
24
+ teardown_db
25
+ super
26
+ end
27
+ end
28
+
29
+ class NoUpdateForSubclassesTest < NoUpdateForSubclassesTestCase
30
+ def setup
31
+ super
32
+ @item_1, @item_2 = (1..2).map do |counter|
33
+ SubTodoItem.create!(position: counter)
34
+ end
35
+ end
36
+
37
+ def test_update
38
+ @item_1.update_attributes(position: 2)
39
+ assert_equal 2, @item_1.reload.position
40
+ assert_equal 1, @item_2.reload.position
41
+ end
42
+
43
+ def test_no_update_for_subclass_instances_with_no_update_on_superclass
44
+ TodoItem.acts_as_list_no_update { @item_1.update_attributes(position: 2) }
45
+
46
+ assert_equal 2, @item_1.reload.position
47
+ assert_equal 2, @item_2.reload.position
48
+ end
49
+
50
+ def test_no_update_for_subclass_instances_with_no_update_on_subclass
51
+ SubTodoItem.acts_as_list_no_update { @item_1.update_attributes(position: 2) }
52
+
53
+ assert_equal 2, @item_1.reload.position
54
+ assert_equal 2, @item_2.reload.position
55
+ end
56
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-06-05 00:00:00.000000000 Z
13
+ date: 2018-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -92,6 +92,7 @@ files:
92
92
  - test/test_list.rb
93
93
  - test/test_no_update_for_extra_classes.rb
94
94
  - test/test_no_update_for_scope_destruction.rb
95
+ - test/test_no_update_for_subclasses.rb
95
96
  homepage: http://github.com/swanandp/acts_as_list
96
97
  licenses:
97
98
  - MIT
@@ -132,3 +133,4 @@ test_files:
132
133
  - test/test_list.rb
133
134
  - test/test_no_update_for_extra_classes.rb
134
135
  - test/test_no_update_for_scope_destruction.rb
136
+ - test/test_no_update_for_subclasses.rb