composite_primary_keys 13.0.6 → 13.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,38 +1,38 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- class CompositeArraysTest < ActiveSupport::TestCase
4
-
5
- def test_new_primary_keys
6
- keys = CompositePrimaryKeys::CompositeKeys.new
7
- assert_not_nil keys
8
- assert_equal '', keys.to_s
9
- assert_equal '', "#{keys}"
10
- end
11
-
12
- def test_initialize_primary_keys
13
- keys = CompositePrimaryKeys::CompositeKeys.new([1,2,3])
14
- assert_not_nil keys
15
- assert_equal '1,2,3', keys.to_s
16
- assert_equal '1,2,3', "#{keys}"
17
- end
18
-
19
- def test_to_composite_keys
20
- keys = [1,2,3].to_composite_keys
21
- assert_equal CompositePrimaryKeys::CompositeKeys, keys.class
22
- assert_equal '1,2,3', keys.to_s
23
- end
24
-
25
- def test_parse
26
- assert_equal ['1', '2'], CompositePrimaryKeys::CompositeKeys.parse('1,2')
27
- assert_equal ['The USA', '^Washington, D.C.'],
28
- CompositePrimaryKeys::CompositeKeys.parse('The USA,^5EWashington^2C D.C.')
29
- assert_equal ['The USA', '^Washington, D.C.'],
30
- CompositePrimaryKeys::CompositeKeys.parse(['The USA', '^Washington, D.C.'])
31
- end
32
-
33
- def test_to_s
34
- assert_equal '1,2', CompositePrimaryKeys::CompositeKeys.new([1, 2]).to_s
35
- assert_equal 'The USA,^5EWashington^2C D.C.',
36
- CompositePrimaryKeys::CompositeKeys.new(['The USA', '^Washington, D.C.']).to_s
37
- end
38
- end
1
+ require File.expand_path('../abstract_unit', __FILE__)
2
+
3
+ class CompositeArraysTest < ActiveSupport::TestCase
4
+
5
+ def test_new_primary_keys
6
+ keys = CompositePrimaryKeys::CompositeKeys.new
7
+ assert_not_nil keys
8
+ assert_equal '', keys.to_s
9
+ assert_equal '', "#{keys}"
10
+ end
11
+
12
+ def test_initialize_primary_keys
13
+ keys = CompositePrimaryKeys::CompositeKeys.new([1,2,3])
14
+ assert_not_nil keys
15
+ assert_equal '1,2,3', keys.to_s
16
+ assert_equal '1,2,3', "#{keys}"
17
+ end
18
+
19
+ def test_to_composite_keys
20
+ keys = [1,2,3].to_composite_keys
21
+ assert_equal CompositePrimaryKeys::CompositeKeys, keys.class
22
+ assert_equal '1,2,3', keys.to_s
23
+ end
24
+
25
+ def test_parse
26
+ assert_equal ['1', '2'], CompositePrimaryKeys::CompositeKeys.parse('1,2')
27
+ assert_equal ['The USA', '^Washington, D.C.'],
28
+ CompositePrimaryKeys::CompositeKeys.parse('The USA,^5EWashington^2C D.C.')
29
+ assert_equal ['The USA', '^Washington, D.C.'],
30
+ CompositePrimaryKeys::CompositeKeys.parse(['The USA', '^Washington, D.C.'])
31
+ end
32
+
33
+ def test_to_s
34
+ assert_equal '1,2', CompositePrimaryKeys::CompositeKeys.new([1, 2]).to_s
35
+ assert_equal 'The USA,^5EWashington^2C D.C.',
36
+ CompositePrimaryKeys::CompositeKeys.new(['The USA', '^Washington, D.C.']).to_s
37
+ end
38
+ end
@@ -40,4 +40,10 @@ class TestPolymorphic < ActiveSupport::TestCase
40
40
  article.user_commentators = []
41
41
  assert_equal(0, article.comments.size)
42
42
  end
43
+
44
+ def test_polymorphic_has_many_with_polymorphic_name
45
+ comments = UserWithPolymorphicName.find(1).comments
46
+ assert_equal 1, comments[0].person_id
47
+ assert_equal "User1", comments[0].person_type
48
+ end
43
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composite_primary_keys
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.6
4
+ version: 13.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-04 00:00:00.000000000 Z
11
+ date: 2023-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -165,13 +165,13 @@ files:
165
165
  - test/fixtures/topic_sources.yml
166
166
  - test/fixtures/topics.yml
167
167
  - test/fixtures/user.rb
168
+ - test/fixtures/user_with_polymorphic_name.rb
168
169
  - test/fixtures/users.yml
169
170
  - test/plugins/pagination.rb
170
171
  - test/plugins/pagination_helper.rb
171
172
  - test/test_associations.rb
172
173
  - test/test_attribute_methods.rb
173
174
  - test/test_attributes.rb
174
- - test/test_bug.rb
175
175
  - test/test_calculations.rb
176
176
  - test/test_callbacks.rb
177
177
  - test/test_composite_arrays.rb
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  - !ruby/object:Gem::Version
218
218
  version: '0'
219
219
  requirements: []
220
- rubygems_version: 3.4.6
220
+ rubygems_version: 3.4.21
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: Composite key support for ActiveRecord
@@ -227,7 +227,6 @@ test_files:
227
227
  - test/test_associations.rb
228
228
  - test/test_attribute_methods.rb
229
229
  - test/test_attributes.rb
230
- - test/test_bug.rb
231
230
  - test/test_calculations.rb
232
231
  - test/test_callbacks.rb
233
232
  - test/test_composite_arrays.rb
data/test/test_bug.rb DELETED
@@ -1,45 +0,0 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- require "bundler/inline"
4
-
5
-
6
- require "minitest/autorun"
7
- require "logger"
8
-
9
- # This connection will do for database-independent bug reports.
10
- ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
11
- ActiveRecord::Base.logger = Logger.new(STDOUT)
12
-
13
- ActiveRecord::Schema.define do
14
- create_table :parents, force: true do |t|
15
- end
16
-
17
- create_table :children, id: false, force: true do |t|
18
- t.bigint :id
19
- t.bigint :parent_id
20
- end
21
- end
22
-
23
- class Parent < ActiveRecord::Base
24
- end
25
-
26
- class Child < ActiveRecord::Base
27
- belongs_to :parent
28
- end
29
-
30
- class BugTest < Minitest::Test
31
- def test_association_stuff
32
- p1 = Parent.create!
33
- p2 = Parent.create!
34
- p3 = Parent.create!
35
- Child.create!(id: 100, parent_id: p1.id)
36
- Child.create!(id: 100, parent_id: p2.id)
37
- Child.create!(id: 100, parent_id: p3.id)
38
-
39
- children = Child.preload(:parent)
40
- # if uncomment following line, this test pass
41
- # children = Child.all
42
- parents = children.map(&:parent)
43
- assert_equal [p1.id, p2.id, p3.id], parents.map(&:id)
44
- end
45
- end