composite_primary_keys 14.0.7 → 14.0.9

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.
@@ -1,44 +1,44 @@
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
-
39
- def test_to_param
40
- assert_equal '1,2', CompositePrimaryKeys::CompositeKeys.new([1, 2]).to_param
41
- assert_equal 'The USA,^5EWashington^2C D.C.',
42
- CompositePrimaryKeys::CompositeKeys.new(['The USA', '^Washington, D.C.']).to_param
43
- end
44
- 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
+
39
+ def test_to_param
40
+ assert_equal '1,2', CompositePrimaryKeys::CompositeKeys.new([1, 2]).to_param
41
+ assert_equal 'The USA,^5EWashington^2C D.C.',
42
+ CompositePrimaryKeys::CompositeKeys.new(['The USA', '^Washington, D.C.']).to_param
43
+ end
44
+ end
@@ -64,4 +64,27 @@ class TestNestedAttributes < ActiveSupport::TestCase
64
64
  assert_equal(reference_code.code_label, 'XX')
65
65
  assert_equal(reference_code.abbreviation, 'Xx')
66
66
  end
67
+
68
+ def test_nested_atttribute_update_4
69
+ code_id = 1003
70
+
71
+ reference_type = reference_types(:name_prefix)
72
+ reference_type.update :reference_codes_attributes => [{
73
+ :reference_code => code_id,
74
+ :code_label => 'XX',
75
+ :abbreviation => 'Xx'
76
+ }]
77
+ assert_not_nil ReferenceCode.find_by_reference_code(code_id)
78
+ reference_code = ReferenceCode.find_by_reference_code(code_id)
79
+ # directly pass :id as a array
80
+ reference_type.update :reference_codes_attributes => [{
81
+ :id => [reference_type.reference_type_id, code_id],
82
+ :code_label => 'AAA',
83
+ :abbreviation => 'Aaa'
84
+ }]
85
+
86
+ reference_code = ReferenceCode.find_by_reference_code(code_id)
87
+ assert_kind_of(ReferenceCode, reference_code)
88
+ assert_equal(reference_code.code_label, 'AAA')
89
+ end
67
90
  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: 14.0.7
4
+ version: 14.0.9
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-11-04 00:00:00.000000000 Z
11
+ date: 2023-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubygems_version: 3.4.10
225
+ rubygems_version: 3.4.21
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Composite key support for ActiveRecord