acts_as_list 0.9.18 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,13 +53,8 @@ class NoUpdateForScopeDestructionTestCase < Minitest::Test
53
53
  end
54
54
 
55
55
  def test_no_update_children_when_parent_destroyed
56
- if ActiveRecord::VERSION::MAJOR < 4
57
- DestructionTodoItem.any_instance.expects(:decrement_positions_on_lower_items).once
58
- DestructionTadaItem.any_instance.expects(:decrement_positions_on_lower_items).once
59
- else
60
- DestructionTodoItem.any_instance.expects(:decrement_positions_on_lower_items).never
61
- DestructionTadaItem.any_instance.expects(:decrement_positions_on_lower_items).never
62
- end
56
+ DestructionTodoItem.any_instance.expects(:decrement_positions_on_lower_items).never
57
+ DestructionTadaItem.any_instance.expects(:decrement_positions_on_lower_items).never
63
58
  assert @list.destroy
64
59
  end
65
60
 
@@ -35,20 +35,20 @@ class NoUpdateForSubclassesTest < NoUpdateForSubclassesTestCase
35
35
  end
36
36
 
37
37
  def test_update
38
- @item_1.update_attributes(position: 2)
38
+ @item_1.update position: 2
39
39
  assert_equal 2, @item_1.reload.position
40
40
  assert_equal 1, @item_2.reload.position
41
41
  end
42
42
 
43
43
  def test_no_update_for_subclass_instances_with_no_update_on_superclass
44
- MasterItem.acts_as_list_no_update { @item_1.update_attributes(position: 2) }
44
+ MasterItem.acts_as_list_no_update { @item_1.update position: 2 }
45
45
 
46
46
  assert_equal 2, @item_1.reload.position
47
47
  assert_equal 2, @item_2.reload.position
48
48
  end
49
49
 
50
50
  def test_no_update_for_subclass_instances_with_no_update_on_subclass
51
- SlaveItem.acts_as_list_no_update { @item_1.update_attributes(position: 2) }
51
+ SlaveItem.acts_as_list_no_update { @item_1.update position: 2 }
52
52
 
53
53
  assert_equal 2, @item_1.reload.position
54
54
  assert_equal 2, @item_2.reload.position
@@ -0,0 +1,42 @@
1
+ require 'helper'
2
+
3
+ class Checklist < ActiveRecord::Base
4
+ has_many :checklist_items, foreign_key: 'list_id', inverse_of: :checklist
5
+ end
6
+
7
+ class ChecklistItem < ActiveRecord::Base
8
+ belongs_to :checklist, foreign_key: 'list_id', inverse_of: :checklist_items
9
+ acts_as_list scope: :checklist
10
+ end
11
+
12
+ class ScopeWithUserDefinedForeignKeyTest < Minitest::Test
13
+ def setup
14
+ ActiveRecord::Base.connection.create_table :checklists do |t|
15
+ end
16
+
17
+ ActiveRecord::Base.connection.create_table :checklist_items do |t|
18
+ t.column :list_id, :integer
19
+ t.column :position, :integer
20
+ end
21
+
22
+ ActiveRecord::Base.connection.schema_cache.clear!
23
+ [Checklist, ChecklistItem].each(&:reset_column_information)
24
+ super
25
+ end
26
+
27
+ def teardown
28
+ teardown_db
29
+ super
30
+ end
31
+
32
+ def test_scope_with_user_defined_foreign_key
33
+ checklist = Checklist.create
34
+ checklist_item_1 = checklist.checklist_items.create
35
+ checklist_item_2 = checklist.checklist_items.create
36
+ checklist_item_3 = checklist.checklist_items.create
37
+
38
+ assert_equal 1, checklist_item_1.position
39
+ assert_equal 2, checklist_item_2.position
40
+ assert_equal 3, checklist_item_3.position
41
+ end
42
+ end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.18
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - David Heinemeier Hansson
8
7
  - Swanand Pagnis
9
- - Quinn Chaffee
8
+ - Brendon Muir
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2019-03-07 00:00:00.000000000 Z
12
+ date: 2020-12-24 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activerecord
@@ -18,14 +17,14 @@ dependencies:
18
17
  requirements:
19
18
  - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: '3.0'
20
+ version: '4.2'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
24
  requirements:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
28
- version: '3.0'
27
+ version: '4.2'
29
28
  - !ruby/object:Gem::Dependency
30
29
  name: bundler
31
30
  requirement: !ruby/object:Gem::Requirement
@@ -45,11 +44,13 @@ description: This "acts_as" extension provides the capabilities for sorting and
45
44
  "position" column defined as an integer on the mapped database table.
46
45
  email:
47
46
  - swanand.pagnis@gmail.com
47
+ - brendon@spikeatschool.co.nz
48
48
  executables: []
49
49
  extensions: []
50
50
  extra_rdoc_files: []
51
51
  files:
52
52
  - ".gemtest"
53
+ - ".github/FUNDING.yml"
53
54
  - ".gitignore"
54
55
  - ".travis.yml"
55
56
  - Appraisals
@@ -59,12 +60,12 @@ files:
59
60
  - README.md
60
61
  - Rakefile
61
62
  - acts_as_list.gemspec
62
- - gemfiles/rails_3_2.gemfile
63
- - gemfiles/rails_4_1.gemfile
64
63
  - gemfiles/rails_4_2.gemfile
65
64
  - gemfiles/rails_5_0.gemfile
66
65
  - gemfiles/rails_5_1.gemfile
67
66
  - gemfiles/rails_5_2.gemfile
67
+ - gemfiles/rails_6_0.gemfile
68
+ - gemfiles/rails_6_1.gemfile
68
69
  - init.rb
69
70
  - lib/acts_as_list.rb
70
71
  - lib/acts_as_list/active_record/acts/active_record.rb
@@ -94,13 +95,14 @@ files:
94
95
  - test/test_no_update_for_extra_classes.rb
95
96
  - test/test_no_update_for_scope_destruction.rb
96
97
  - test/test_no_update_for_subclasses.rb
97
- homepage: http://github.com/swanandp/acts_as_list
98
+ - test/test_scope_with_user_defined_foreign_key.rb
99
+ homepage: http://github.com/brendon/acts_as_list
98
100
  licenses:
99
101
  - MIT
100
102
  metadata:
101
- changelog_uri: https://github.com/swanandp/acts_as_list/blob/master/CHANGELOG.md
102
- source_code_uri: https://github.com/swanandp/acts_as_list
103
- bug_tracker_uri: https://github.com/swanandp/acts_as_list/issues
103
+ changelog_uri: https://github.com/brendon/acts_as_list/blob/master/CHANGELOG.md
104
+ source_code_uri: https://github.com/brendon/acts_as_list
105
+ bug_tracker_uri: https://github.com/brendon/acts_as_list/issues
104
106
  post_install_message:
105
107
  rdoc_options: []
106
108
  require_paths:
@@ -109,15 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
111
  requirements:
110
112
  - - ">="
111
113
  - !ruby/object:Gem::Version
112
- version: 1.9.2
114
+ version: 2.4.7
113
115
  required_rubygems_version: !ruby/object:Gem::Requirement
114
116
  requirements:
115
117
  - - ">="
116
118
  - !ruby/object:Gem::Version
117
119
  version: '0'
118
120
  requirements: []
119
- rubyforge_project: acts_as_list
120
- rubygems_version: 2.5.2.2
121
+ rubygems_version: 3.0.3
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: A gem adding sorting, reordering capabilities to an active_record model,
@@ -139,3 +140,4 @@ test_files:
139
140
  - test/test_no_update_for_extra_classes.rb
140
141
  - test/test_no_update_for_scope_destruction.rb
141
142
  - test/test_no_update_for_subclasses.rb
143
+ - test/test_scope_with_user_defined_foreign_key.rb
@@ -1,34 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rack", "~> 1", platforms: [:ruby_19, :ruby_20, :ruby_21]
6
- gem "rake", "~> 12.2.0", platforms: [:ruby_19]
7
- gem "appraisal"
8
- gem "activerecord", "~> 3.2.22.2"
9
-
10
- group :development do
11
- gem "github_changelog_generator", "1.9.0"
12
- end
13
-
14
- group :test do
15
- gem "minitest", "~> 5.0"
16
- gem "test_after_commit", "~> 0.4.2"
17
- gem "timecop"
18
- gem "mocha"
19
- gem "after_commit_exception_notification"
20
- end
21
-
22
- group :sqlite do
23
- gem "sqlite3", "~> 1.3.13", platforms: [:ruby]
24
- end
25
-
26
- group :postgresql do
27
- gem "pg", "~> 0.18.0", platforms: [:ruby]
28
- end
29
-
30
- group :mysql do
31
- gem "mysql2", "~> 0.3.21", platforms: [:ruby]
32
- end
33
-
34
- gemspec path: "../"
@@ -1,34 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rack", "~> 1", platforms: [:ruby_19, :ruby_20, :ruby_21]
6
- gem "rake", "~> 12.2.0", platforms: [:ruby_19]
7
- gem "appraisal"
8
- gem "activerecord", "~> 4.1.16"
9
-
10
- group :development do
11
- gem "github_changelog_generator", "1.9.0"
12
- end
13
-
14
- group :test do
15
- gem "minitest", "~> 5.0"
16
- gem "test_after_commit", "~> 0.4.2"
17
- gem "timecop"
18
- gem "mocha"
19
- gem "after_commit_exception_notification"
20
- end
21
-
22
- group :sqlite do
23
- gem "sqlite3", "~> 1.3.13", platforms: [:ruby]
24
- end
25
-
26
- group :postgresql do
27
- gem "pg", "~> 0.18.0", platforms: [:ruby]
28
- end
29
-
30
- group :mysql do
31
- gem "mysql2", "~> 0.3.21", platforms: [:ruby]
32
- end
33
-
34
- gemspec path: "../"