assignable_values 0.16.5 → 0.16.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f048184ed974a9878de297fd61fb4839872c0f3d420ca4fc7404c9ed4afd985c
4
- data.tar.gz: b6a3a9e3fbdbb135130ff94e61abfc54702762e1fc517aba0f75a0e71cf550aa
3
+ metadata.gz: 5b8661c6374664b624b4fd0a3e54529ac3783fff619a7d846b9c2836e8839608
4
+ data.tar.gz: 2c72259b1eee2a767778975f95a6ac4f08ed02bbda8056426d7e7bca19e004da
5
5
  SHA512:
6
- metadata.gz: 788afc6930322071801a893621d516c733ab0bcd2a60bda0e9898d4d7711955d69a8ca2659e2cd6d693cf33134884a9c323372615300eb0103cf3da294442eda
7
- data.tar.gz: 381ec97d744d0b97a2eef32aa9b2e03a03b157a3cf1537abdf1bd95a8e090ddc6ddcb11ae56653f4efe9be5cb8126cf4a64d4a234e3efab88ebeb819caf86c0c
6
+ metadata.gz: 774ebe2bd0bbee83b66ab01a4a8358068c86688a543fdaea24b8f54220b7b9533de93d163c8d263a35dd33e6cd5855f9eeb4132e9b83a1e2d71f6fbb5bb647ce
7
+ data.tar.gz: 1a7e51073af59fe8bcaf86537de1ba7d7c33fd116f5573c0a171915cc00ad975b16062d1e327caeee7f38afc21baee695dbd2a8e7cf09d573d0512f80201be65
@@ -26,16 +26,6 @@ jobs:
26
26
  fail-fast: false
27
27
  matrix:
28
28
  include:
29
- - ruby: 2.3.8
30
- gemfile: Gemfile.4.2
31
- - ruby: 2.3.8
32
- gemfile: Gemfile.5.0
33
- - ruby: 2.3.8
34
- gemfile: Gemfile.5.1
35
- - ruby: 2.4.2
36
- gemfile: Gemfile.5.0
37
- - ruby: 2.4.2
38
- gemfile: Gemfile.5.1
39
29
  - ruby: 2.5.3
40
30
  gemfile: Gemfile.5.0
41
31
  - ruby: 2.5.3
@@ -48,10 +38,6 @@ jobs:
48
38
  uses: ruby/setup-ruby@v1
49
39
  with:
50
40
  ruby-version: "${{ matrix.ruby }}"
51
- - name: Install database client
52
- run: |
53
- sudo apt-get update
54
- sudo apt-get install -y mysql-client libmariadbclient-dev
55
41
  - name: Bundle
56
42
  run: |
57
43
  gem install bundler:2.1.4
@@ -76,14 +62,18 @@ jobs:
76
62
  fail-fast: false
77
63
  matrix:
78
64
  include:
79
- - ruby: 2.3.8
80
- gemfile: Gemfile.5.1.pg
81
- - ruby: 2.4.2
82
- gemfile: Gemfile.5.1.pg
83
65
  - ruby: 2.5.3
84
66
  gemfile: Gemfile.5.1.pg
85
67
  - ruby: 2.5.3
86
- gemfile: Gemfile.6.0.pg
68
+ gemfile: Gemfile.6.1.pg
69
+ - ruby: 2.7.3
70
+ gemfile: Gemfile.6.1.pg
71
+ - ruby: 2.7.3
72
+ gemfile: Gemfile.7.0.pg
73
+ - ruby: 3.0.1
74
+ gemfile: Gemfile.6.1.pg
75
+ - ruby: 3.0.1
76
+ gemfile: Gemfile.7.0.pg
87
77
  env:
88
78
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
89
79
  steps:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.8
1
+ 3.0.1
data/CHANGELOG.md CHANGED
@@ -6,8 +6,22 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
6
6
 
7
7
  ### Breaking changes
8
8
 
9
+ -
10
+
9
11
  ### Compatible changes
10
12
 
13
+ -
14
+
15
+ ## 0.16.6 - 2022-03-16
16
+
17
+ ### Breaking changes
18
+
19
+ - Remove no longer supported ruby versions (2.3.8, 2.4.2)
20
+
21
+ ### Compatible changes
22
+
23
+ - test against ActiveRecord 7.0
24
+
11
25
  ## 0.16.5 - 2021-01-10
12
26
 
13
27
  ### Compatible changes
data/Gemfile CHANGED
@@ -1 +1 @@
1
- ./Gemfile.4.2
1
+ ./Gemfile.7.0.pg
@@ -1,9 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Runtime dependencies
4
- gem 'activerecord', '~>6.0.0'
4
+ gem 'activerecord', '~>6.1.3'
5
5
  gem 'i18n'
6
- gem 'pg', '<1'
6
+ gem 'pg', '1.1'
7
7
 
8
8
  # Development dependencies
9
9
  gem 'rake'
@@ -1,31 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- assignable_values (0.16.4)
4
+ assignable_values (0.16.5)
5
5
  activerecord (>= 2.3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.0.0)
11
- activesupport (= 6.0.0)
12
- activerecord (6.0.0)
13
- activemodel (= 6.0.0)
14
- activesupport (= 6.0.0)
15
- activesupport (6.0.0)
10
+ activemodel (6.1.3.2)
11
+ activesupport (= 6.1.3.2)
12
+ activerecord (6.1.3.2)
13
+ activemodel (= 6.1.3.2)
14
+ activesupport (= 6.1.3.2)
15
+ activesupport (6.1.3.2)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- zeitwerk (~> 2.1, >= 2.1.8)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
21
  concurrent-ruby (1.1.5)
22
22
  database_cleaner (1.7.0)
23
23
  diff-lcs (1.3)
24
- gemika (0.3.4)
24
+ gemika (0.5.0)
25
25
  i18n (1.6.0)
26
26
  concurrent-ruby (~> 1.0)
27
- minitest (5.11.3)
28
- pg (0.21.0)
27
+ minitest (5.14.4)
28
+ pg (1.1.0)
29
29
  rake (12.3.2)
30
30
  rspec (3.8.0)
31
31
  rspec-core (~> 3.8.0)
@@ -45,24 +45,23 @@ GEM
45
45
  sneaky-save
46
46
  sneaky-save (0.1.3)
47
47
  activerecord (>= 3.2.0)
48
- thread_safe (0.3.6)
49
- tzinfo (1.2.5)
50
- thread_safe (~> 0.1)
51
- zeitwerk (2.1.9)
48
+ tzinfo (2.0.4)
49
+ concurrent-ruby (~> 1.0)
50
+ zeitwerk (2.4.2)
52
51
 
53
52
  PLATFORMS
54
53
  ruby
55
54
 
56
55
  DEPENDENCIES
57
- activerecord (~> 6.0.0)
56
+ activerecord (~> 6.1.3)
58
57
  assignable_values!
59
58
  database_cleaner
60
- gemika
59
+ gemika (>= 0.5.0)
61
60
  i18n
62
- pg (< 1)
61
+ pg (= 1.1)
63
62
  rake
64
63
  rspec
65
64
  rspec_candy
66
65
 
67
66
  BUNDLED WITH
68
- 1.17.3
67
+ 2.2.15
@@ -1,14 +1,14 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Runtime dependencies
4
- gem 'activerecord', '~>4.2.0'
5
- gem 'i18n', '~>0.7.0'
6
- gem 'mysql2'
4
+ gem 'activerecord', '~>7.0.0'
5
+ gem 'i18n'
6
+ gem 'pg', '1.1'
7
7
 
8
8
  # Development dependencies
9
9
  gem 'rake'
10
10
  gem 'database_cleaner'
11
- gem 'rspec', '~> 3.4'
11
+ gem 'rspec'
12
12
  gem 'rspec_candy'
13
13
  gem 'gemika', '>= 0.5.0'
14
14
 
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ assignable_values (0.16.6)
5
+ activerecord (>= 2.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (7.0.0)
11
+ activesupport (= 7.0.0)
12
+ activerecord (7.0.0)
13
+ activemodel (= 7.0.0)
14
+ activesupport (= 7.0.0)
15
+ activesupport (7.0.0)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ concurrent-ruby (1.1.5)
21
+ database_cleaner (1.7.0)
22
+ diff-lcs (1.3)
23
+ gemika (0.5.0)
24
+ i18n (1.6.0)
25
+ concurrent-ruby (~> 1.0)
26
+ minitest (5.15.0)
27
+ pg (1.1.0)
28
+ rake (12.3.2)
29
+ rspec (3.8.0)
30
+ rspec-core (~> 3.8.0)
31
+ rspec-expectations (~> 3.8.0)
32
+ rspec-mocks (~> 3.8.0)
33
+ rspec-core (3.8.0)
34
+ rspec-support (~> 3.8.0)
35
+ rspec-expectations (3.8.2)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.8.0)
38
+ rspec-mocks (3.8.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.8.0)
41
+ rspec-support (3.8.0)
42
+ rspec_candy (0.5.1)
43
+ rspec
44
+ sneaky-save
45
+ sneaky-save (0.1.3)
46
+ activerecord (>= 3.2.0)
47
+ tzinfo (2.0.4)
48
+ concurrent-ruby (~> 1.0)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ activerecord (~> 7.0.0)
55
+ assignable_values!
56
+ database_cleaner
57
+ gemika (>= 0.5.0)
58
+ i18n
59
+ pg (= 1.1)
60
+ rake
61
+ rspec
62
+ rspec_candy
63
+
64
+ BUNDLED WITH
65
+ 2.2.15
data/Gemfile.lock CHANGED
@@ -1 +1 @@
1
- ./Gemfile.4.2.lock
1
+ ./Gemfile.7.0.pg.lock
data/README.md CHANGED
@@ -5,7 +5,7 @@ assignable_values - Enums on vitamins [![Tests](https://github.com/makandra/assi
5
5
 
6
6
  We carefully enhanced the core enum functionality with small tweaks that are useful for web forms, internationalized applications and common authorization patterns.
7
7
 
8
- `assignable_values` is tested with Rails 2.3, 3.2, 4.2, 5.1 and 6.0 (beta) on Ruby 1.8.7, 2.1, 2.3, 2.4 and 2.5.
8
+ `assignable_values` is tested with Rails 5.1 and 6.1 on Ruby 2.5, 2.7 and 3.0.
9
9
 
10
10
 
11
11
  Restricting scalar attributes
@@ -11,6 +11,14 @@ Gem::Specification.new do |s|
11
11
  s.description = s.summary
12
12
  s.license = 'MIT'
13
13
 
14
+ if RUBY_VERSION.to_f >= 2.0
15
+ s.metadata = {
16
+ 'bug_tracker_uri' => 'https://github.com/makandra/assignable_values/issues',
17
+ 'changelog_uri' => 'https://github.com/makandra/assignable_values/blob/master/CHANGELOG.md',
18
+ 'rubygems_mfa_required' => 'true',
19
+ }
20
+ end
21
+
14
22
  s.files = `git ls-files`.split($\)
15
23
  s.test_files = s.files.grep(%r{^spec/})
16
24
  s.require_paths = ["lib"]
@@ -1,3 +1,3 @@
1
1
  module AssignableValues
2
- VERSION = '0.16.5'
2
+ VERSION = '0.16.6'
3
3
  end
@@ -53,6 +53,20 @@ describe AssignableValues::ActiveRecord do
53
53
 
54
54
  end
55
55
 
56
+ context 'when the options are passed as a hash' do
57
+ before :each do
58
+ @klass = Song.disposable_copy do
59
+ assignable_values_for(:virtual_multi_genres, { :multiple => true, :allow_blank => true }) do
60
+ %w[pop rock]
61
+ end
62
+ end
63
+ end
64
+
65
+ it 'should not raise an error' do
66
+ @klass.new(:virtual_multi_genres => ['rock']).should be_valid
67
+ end
68
+ end
69
+
56
70
  context 'when validating virtual attributes with multiple: true' do
57
71
 
58
72
  context 'with allow_blank: false' do
@@ -122,7 +136,7 @@ describe AssignableValues::ActiveRecord do
122
136
  record = @klass.new(:genre => 'disallowed value')
123
137
  record.valid?
124
138
  errors = record.errors[:genre]
125
- error = errors.is_a?(Array) ? errors.first : errors # the return value sometimes was a string, sometimes an Array in Rails
139
+ error = errors.respond_to?(:first) ? errors.first : errors # the return value sometimes was a string, sometimes an Array in Rails
126
140
  error.should == I18n.t('errors.messages.inclusion')
127
141
  error.should == 'is not included in the list'
128
142
  end
@@ -274,7 +288,7 @@ describe AssignableValues::ActiveRecord do
274
288
  record = @klass.new(:genre => 'disallowed value')
275
289
  record.valid?
276
290
  errors = record.errors[:genre]
277
- error = errors.is_a?(Array) ? errors.first : errors # the return value sometimes was a string, sometimes an Array in Rails
291
+ error = errors.respond_to?(:first) ? errors.first : errors # the return value sometimes was a string, sometimes an Array in Rails
278
292
  error.should == 'should be something different'
279
293
  end
280
294
 
@@ -373,7 +387,7 @@ describe AssignableValues::ActiveRecord do
373
387
  record = klass.new(:artist => disallowed_association)
374
388
  record.valid?
375
389
  errors = record.errors[:artist_id]
376
- error = errors.is_a?(Array) ? errors.first : errors # the return value sometimes was a string, sometimes an Array in Rails
390
+ error = errors.respond_to?(:first) ? errors.first : errors # the return value sometimes was a string, sometimes an Array in Rails
377
391
  error.should == I18n.t('errors.messages.inclusion')
378
392
  end
379
393
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assignable_values
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.5
4
+ version: 0.16.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-10 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -36,16 +36,16 @@ files:
36
36
  - ".ruby-version"
37
37
  - CHANGELOG.md
38
38
  - Gemfile
39
- - Gemfile.4.2
40
- - Gemfile.4.2.lock
41
39
  - Gemfile.5.0
42
40
  - Gemfile.5.0.lock
43
41
  - Gemfile.5.1
44
42
  - Gemfile.5.1.lock
45
43
  - Gemfile.5.1.pg
46
44
  - Gemfile.5.1.pg.lock
47
- - Gemfile.6.0.pg
48
- - Gemfile.6.0.pg.lock
45
+ - Gemfile.6.1.pg
46
+ - Gemfile.6.1.pg.lock
47
+ - Gemfile.7.0.pg
48
+ - Gemfile.7.0.pg.lock
49
49
  - Gemfile.lock
50
50
  - LICENSE
51
51
  - README.md
@@ -71,7 +71,10 @@ files:
71
71
  homepage: https://github.com/makandra/assignable_values
72
72
  licenses:
73
73
  - MIT
74
- metadata: {}
74
+ metadata:
75
+ bug_tracker_uri: https://github.com/makandra/assignable_values/issues
76
+ changelog_uri: https://github.com/makandra/assignable_values/blob/master/CHANGELOG.md
77
+ rubygems_mfa_required: 'true'
75
78
  post_install_message:
76
79
  rdoc_options: []
77
80
  require_paths:
@@ -87,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
90
  - !ruby/object:Gem::Version
88
91
  version: '0'
89
92
  requirements: []
90
- rubygems_version: 3.2.9
93
+ rubygems_version: 3.2.15
91
94
  signing_key:
92
95
  specification_version: 4
93
96
  summary: Restrict the values assignable to ActiveRecord attributes or associations
data/Gemfile.4.2.lock DELETED
@@ -1,70 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- assignable_values (0.16.5)
5
- activerecord (>= 2.3)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (4.2.7.1)
11
- activesupport (= 4.2.7.1)
12
- builder (~> 3.1)
13
- activerecord (4.2.7.1)
14
- activemodel (= 4.2.7.1)
15
- activesupport (= 4.2.7.1)
16
- arel (~> 6.0)
17
- activesupport (4.2.7.1)
18
- i18n (~> 0.7)
19
- json (~> 1.7, >= 1.7.7)
20
- minitest (~> 5.1)
21
- thread_safe (~> 0.3, >= 0.3.4)
22
- tzinfo (~> 1.1)
23
- arel (6.0.3)
24
- builder (3.2.2)
25
- database_cleaner (1.5.3)
26
- diff-lcs (1.2.5)
27
- gemika (0.5.0)
28
- i18n (0.7.0)
29
- json (1.8.3)
30
- minitest (5.9.1)
31
- mysql2 (0.4.10)
32
- rake (10.3.2)
33
- rspec (3.5.0)
34
- rspec-core (~> 3.5.0)
35
- rspec-expectations (~> 3.5.0)
36
- rspec-mocks (~> 3.5.0)
37
- rspec-core (3.5.4)
38
- rspec-support (~> 3.5.0)
39
- rspec-expectations (3.5.0)
40
- diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.5.0)
42
- rspec-mocks (3.5.0)
43
- diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.5.0)
45
- rspec-support (3.5.0)
46
- rspec_candy (0.3.1)
47
- rspec
48
- sneaky-save
49
- sneaky-save (0.0.5)
50
- activerecord (>= 3.2.0)
51
- thread_safe (0.3.5)
52
- tzinfo (1.2.2)
53
- thread_safe (~> 0.1)
54
-
55
- PLATFORMS
56
- ruby
57
-
58
- DEPENDENCIES
59
- activerecord (~> 4.2.0)
60
- assignable_values!
61
- database_cleaner
62
- gemika (>= 0.5.0)
63
- i18n (~> 0.7.0)
64
- mysql2
65
- rake
66
- rspec (~> 3.4)
67
- rspec_candy
68
-
69
- BUNDLED WITH
70
- 2.1.4