assignable_values 0.16.0 → 0.16.5
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 +4 -4
- data/.github/workflows/test.yml +104 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +42 -1
- data/Gemfile.4.2 +2 -2
- data/Gemfile.4.2.lock +6 -6
- data/Gemfile.5.0 +1 -1
- data/Gemfile.5.0.lock +34 -33
- data/Gemfile.5.1 +1 -1
- data/Gemfile.5.1.lock +32 -32
- data/Gemfile.5.1.pg +1 -1
- data/Gemfile.5.1.pg.lock +4 -4
- data/{Gemfile.3.2 → Gemfile.6.0.pg} +6 -6
- data/Gemfile.6.0.pg.lock +68 -0
- data/README.md +13 -10
- data/lib/assignable_values/active_record/restriction/base.rb +36 -10
- data/lib/assignable_values/active_record/restriction/scalar_attribute.rb +4 -4
- data/lib/assignable_values/version.rb +1 -1
- data/spec/assignable_values/active_record_spec.rb +179 -52
- data/spec/support/database.github.yml +13 -0
- data/spec/support/database.rb +1 -1
- data/spec/support/i18n.yml +4 -1
- data/spec/support/models.rb +3 -3
- metadata +8 -11
- data/.travis.yml +0 -64
- data/Gemfile.2.3 +0 -16
- data/Gemfile.2.3.lock +0 -40
- data/Gemfile.3.2.lock +0 -65
- data/spec/support/database.travis.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f048184ed974a9878de297fd61fb4839872c0f3d420ca4fc7404c9ed4afd985c
|
4
|
+
data.tar.gz: b6a3a9e3fbdbb135130ff94e61abfc54702762e1fc517aba0f75a0e71cf550aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788afc6930322071801a893621d516c733ab0bcd2a60bda0e9898d4d7711955d69a8ca2659e2cd6d693cf33134884a9c323372615300eb0103cf3da294442eda
|
7
|
+
data.tar.gz: 381ec97d744d0b97a2eef32aa9b2e03a03b157a3cf1537abdf1bd95a8e090ddc6ddcb11ae56653f4efe9be5cb8126cf4a64d4a234e3efab88ebeb819caf86c0c
|
@@ -0,0 +1,104 @@
|
|
1
|
+
---
|
2
|
+
name: Tests
|
3
|
+
'on':
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
test_mysql:
|
12
|
+
runs-on: ubuntu-20.04
|
13
|
+
services:
|
14
|
+
mysql:
|
15
|
+
image: mysql:5.6
|
16
|
+
env:
|
17
|
+
MYSQL_ROOT_PASSWORD: password
|
18
|
+
ports:
|
19
|
+
- 3306:3306
|
20
|
+
options: >-
|
21
|
+
--health-cmd="mysqladmin ping"
|
22
|
+
--health-interval=10s
|
23
|
+
--health-timeout=5s
|
24
|
+
--health-retries=3
|
25
|
+
strategy:
|
26
|
+
fail-fast: false
|
27
|
+
matrix:
|
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
|
+
- ruby: 2.5.3
|
40
|
+
gemfile: Gemfile.5.0
|
41
|
+
- ruby: 2.5.3
|
42
|
+
gemfile: Gemfile.5.1
|
43
|
+
env:
|
44
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
45
|
+
steps:
|
46
|
+
- uses: actions/checkout@v2
|
47
|
+
- name: Install ruby
|
48
|
+
uses: ruby/setup-ruby@v1
|
49
|
+
with:
|
50
|
+
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
|
+
- name: Bundle
|
56
|
+
run: |
|
57
|
+
gem install bundler:2.1.4
|
58
|
+
bundle install --no-deployment
|
59
|
+
- name: Setup databases
|
60
|
+
run: |
|
61
|
+
mysql -e 'create database IF NOT EXISTS assignable_values_test;' -u root --password=password -P 3306 -h 127.0.0.1
|
62
|
+
- name: Run tests
|
63
|
+
run: bundle exec rspec
|
64
|
+
test_pg:
|
65
|
+
runs-on: ubuntu-20.04
|
66
|
+
services:
|
67
|
+
postgres:
|
68
|
+
image: postgres
|
69
|
+
env:
|
70
|
+
POSTGRES_PASSWORD: postgres
|
71
|
+
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s
|
72
|
+
--health-retries 5"
|
73
|
+
ports:
|
74
|
+
- 5432:5432
|
75
|
+
strategy:
|
76
|
+
fail-fast: false
|
77
|
+
matrix:
|
78
|
+
include:
|
79
|
+
- ruby: 2.3.8
|
80
|
+
gemfile: Gemfile.5.1.pg
|
81
|
+
- ruby: 2.4.2
|
82
|
+
gemfile: Gemfile.5.1.pg
|
83
|
+
- ruby: 2.5.3
|
84
|
+
gemfile: Gemfile.5.1.pg
|
85
|
+
- ruby: 2.5.3
|
86
|
+
gemfile: Gemfile.6.0.pg
|
87
|
+
env:
|
88
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
89
|
+
steps:
|
90
|
+
- uses: actions/checkout@v2
|
91
|
+
- name: Install ruby
|
92
|
+
uses: ruby/setup-ruby@v1
|
93
|
+
with:
|
94
|
+
ruby-version: "${{ matrix.ruby }}"
|
95
|
+
- name: Setup database
|
96
|
+
run: |
|
97
|
+
sudo apt-get install -y postgresql-client
|
98
|
+
PGPASSWORD=postgres psql -c 'create database assignable_values_test;' -U postgres -p 5432 -h localhost
|
99
|
+
- name: Bundle
|
100
|
+
run: |
|
101
|
+
gem install bundler:2.1.4
|
102
|
+
bundle install --no-deployment
|
103
|
+
- name: Run tests
|
104
|
+
run: bundle exec rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.8
|
data/CHANGELOG.md
CHANGED
@@ -8,12 +8,53 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
8
8
|
|
9
9
|
### Compatible changes
|
10
10
|
|
11
|
+
## 0.16.5 - 2021-01-10
|
12
|
+
|
13
|
+
### Compatible changes
|
14
|
+
|
15
|
+
- Previously assigned values are no longer duplicated when calling the assignable_values method (fixes #32)
|
16
|
+
|
17
|
+
## 0.16.4 - 2020-10-15
|
18
|
+
|
19
|
+
### Compatible changes
|
20
|
+
|
21
|
+
- No longer crashes value blocks return `nil`.
|
22
|
+
|
23
|
+
|
24
|
+
## 0.16.3 - 2020-10-15
|
25
|
+
|
26
|
+
### Compatible changes
|
27
|
+
|
28
|
+
- No longer crashes when assigning `nil` to an attribute with assignable values that are provided as a scope.
|
29
|
+
|
30
|
+
|
31
|
+
## 0.16.2 - 2020-10-06
|
32
|
+
|
33
|
+
### Compatible changes
|
34
|
+
|
35
|
+
- when given a scope, do not load all records to memory during validation
|
36
|
+
|
37
|
+
|
38
|
+
## 0.16.1 - 2019-05-14
|
39
|
+
|
40
|
+
### Compatible changes
|
41
|
+
|
42
|
+
- add tests for Rails 6
|
43
|
+
- Humanized assignable value methods now also take the include_old_values option (fixes #25)
|
44
|
+
|
45
|
+
|
46
|
+
## 0.16.0 - 2019-02-20
|
47
|
+
|
48
|
+
### Breaking changes
|
49
|
+
|
50
|
+
- fix arity bug
|
51
|
+
|
11
52
|
|
12
53
|
## 0.15.1 - 2018-11-05
|
13
54
|
|
14
55
|
### Compatible changes
|
15
56
|
|
16
|
-
- Add `#humanized_values` for the `
|
57
|
+
- Add `#humanized_values` for the `multiple: true` case.
|
17
58
|
|
18
59
|
|
19
60
|
## 0.15.0 - 2018-10-26
|
data/Gemfile.4.2
CHANGED
@@ -3,14 +3,14 @@ source 'https://rubygems.org'
|
|
3
3
|
# Runtime dependencies
|
4
4
|
gem 'activerecord', '~>4.2.0'
|
5
5
|
gem 'i18n', '~>0.7.0'
|
6
|
-
gem 'mysql2'
|
6
|
+
gem 'mysql2'
|
7
7
|
|
8
8
|
# Development dependencies
|
9
9
|
gem 'rake'
|
10
10
|
gem 'database_cleaner'
|
11
11
|
gem 'rspec', '~> 3.4'
|
12
12
|
gem 'rspec_candy'
|
13
|
-
gem 'gemika'
|
13
|
+
gem 'gemika', '>= 0.5.0'
|
14
14
|
|
15
15
|
# Gem under test
|
16
16
|
gem 'assignable_values', :path => '.'
|
data/Gemfile.4.2.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
assignable_values (0.
|
4
|
+
assignable_values (0.16.5)
|
5
5
|
activerecord (>= 2.3)
|
6
6
|
|
7
7
|
GEM
|
@@ -24,11 +24,11 @@ GEM
|
|
24
24
|
builder (3.2.2)
|
25
25
|
database_cleaner (1.5.3)
|
26
26
|
diff-lcs (1.2.5)
|
27
|
-
gemika (0.
|
27
|
+
gemika (0.5.0)
|
28
28
|
i18n (0.7.0)
|
29
29
|
json (1.8.3)
|
30
30
|
minitest (5.9.1)
|
31
|
-
mysql2 (0.
|
31
|
+
mysql2 (0.4.10)
|
32
32
|
rake (10.3.2)
|
33
33
|
rspec (3.5.0)
|
34
34
|
rspec-core (~> 3.5.0)
|
@@ -59,12 +59,12 @@ DEPENDENCIES
|
|
59
59
|
activerecord (~> 4.2.0)
|
60
60
|
assignable_values!
|
61
61
|
database_cleaner
|
62
|
-
gemika
|
62
|
+
gemika (>= 0.5.0)
|
63
63
|
i18n (~> 0.7.0)
|
64
|
-
mysql2
|
64
|
+
mysql2
|
65
65
|
rake
|
66
66
|
rspec (~> 3.4)
|
67
67
|
rspec_candy
|
68
68
|
|
69
69
|
BUNDLED WITH
|
70
|
-
1.
|
70
|
+
2.1.4
|
data/Gemfile.5.0
CHANGED
data/Gemfile.5.0.lock
CHANGED
@@ -1,52 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
assignable_values (0.
|
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 (5.0.
|
11
|
-
activesupport (= 5.0.
|
12
|
-
activerecord (5.0.
|
13
|
-
activemodel (= 5.0.
|
14
|
-
activesupport (= 5.0.
|
10
|
+
activemodel (5.0.7.2)
|
11
|
+
activesupport (= 5.0.7.2)
|
12
|
+
activerecord (5.0.7.2)
|
13
|
+
activemodel (= 5.0.7.2)
|
14
|
+
activesupport (= 5.0.7.2)
|
15
15
|
arel (~> 7.0)
|
16
|
-
activesupport (5.0.
|
16
|
+
activesupport (5.0.7.2)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (
|
18
|
+
i18n (>= 0.7, < 2)
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
21
|
arel (7.1.4)
|
22
|
-
concurrent-ruby (1.
|
23
|
-
database_cleaner (1.5
|
24
|
-
diff-lcs (1.
|
25
|
-
gemika (0.
|
26
|
-
i18n (
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
rspec-
|
33
|
-
rspec-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
concurrent-ruby (1.1.7)
|
23
|
+
database_cleaner (1.8.5)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
gemika (0.5.0)
|
26
|
+
i18n (1.8.5)
|
27
|
+
concurrent-ruby (~> 1.0)
|
28
|
+
minitest (5.14.2)
|
29
|
+
mysql2 (0.5.3)
|
30
|
+
rake (13.0.1)
|
31
|
+
rspec (3.10.0)
|
32
|
+
rspec-core (~> 3.10.0)
|
33
|
+
rspec-expectations (~> 3.10.0)
|
34
|
+
rspec-mocks (~> 3.10.0)
|
35
|
+
rspec-core (3.10.0)
|
36
|
+
rspec-support (~> 3.10.0)
|
37
|
+
rspec-expectations (3.10.0)
|
37
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-mocks (3.
|
39
|
+
rspec-support (~> 3.10.0)
|
40
|
+
rspec-mocks (3.10.0)
|
40
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.
|
42
|
-
rspec-support (3.
|
43
|
-
rspec_candy (0.
|
42
|
+
rspec-support (~> 3.10.0)
|
43
|
+
rspec-support (3.10.0)
|
44
|
+
rspec_candy (0.5.1)
|
44
45
|
rspec
|
45
46
|
sneaky-save
|
46
|
-
sneaky-save (0.1.
|
47
|
+
sneaky-save (0.1.3)
|
47
48
|
activerecord (>= 3.2.0)
|
48
|
-
thread_safe (0.3.
|
49
|
-
tzinfo (1.2.
|
49
|
+
thread_safe (0.3.6)
|
50
|
+
tzinfo (1.2.7)
|
50
51
|
thread_safe (~> 0.1)
|
51
52
|
|
52
53
|
PLATFORMS
|
@@ -56,7 +57,7 @@ DEPENDENCIES
|
|
56
57
|
activerecord (~> 5.0.0)
|
57
58
|
assignable_values!
|
58
59
|
database_cleaner
|
59
|
-
gemika
|
60
|
+
gemika (>= 0.5.0)
|
60
61
|
i18n
|
61
62
|
mysql2
|
62
63
|
rake
|
@@ -64,4 +65,4 @@ DEPENDENCIES
|
|
64
65
|
rspec_candy
|
65
66
|
|
66
67
|
BUNDLED WITH
|
67
|
-
1.
|
68
|
+
2.1.4
|
data/Gemfile.5.1
CHANGED
data/Gemfile.5.1.lock
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
assignable_values (0.
|
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 (5.1.
|
11
|
-
activesupport (= 5.1.
|
12
|
-
activerecord (5.1.
|
13
|
-
activemodel (= 5.1.
|
14
|
-
activesupport (= 5.1.
|
10
|
+
activemodel (5.1.7)
|
11
|
+
activesupport (= 5.1.7)
|
12
|
+
activerecord (5.1.7)
|
13
|
+
activemodel (= 5.1.7)
|
14
|
+
activesupport (= 5.1.7)
|
15
15
|
arel (~> 8.0)
|
16
|
-
activesupport (5.1.
|
16
|
+
activesupport (5.1.7)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (
|
18
|
+
i18n (>= 0.7, < 2)
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
21
|
arel (8.0.0)
|
22
|
-
concurrent-ruby (1.
|
23
|
-
database_cleaner (1.
|
24
|
-
diff-lcs (1.
|
25
|
-
gemika (0.
|
26
|
-
i18n (
|
22
|
+
concurrent-ruby (1.1.7)
|
23
|
+
database_cleaner (1.8.5)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
gemika (0.5.0)
|
26
|
+
i18n (1.8.5)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
|
-
minitest (5.
|
29
|
-
mysql2 (0.
|
30
|
-
rake (
|
31
|
-
rspec (3.
|
32
|
-
rspec-core (~> 3.
|
33
|
-
rspec-expectations (~> 3.
|
34
|
-
rspec-mocks (~> 3.
|
35
|
-
rspec-core (3.
|
36
|
-
rspec-support (~> 3.
|
37
|
-
rspec-expectations (3.
|
28
|
+
minitest (5.14.2)
|
29
|
+
mysql2 (0.5.3)
|
30
|
+
rake (13.0.1)
|
31
|
+
rspec (3.10.0)
|
32
|
+
rspec-core (~> 3.10.0)
|
33
|
+
rspec-expectations (~> 3.10.0)
|
34
|
+
rspec-mocks (~> 3.10.0)
|
35
|
+
rspec-core (3.10.0)
|
36
|
+
rspec-support (~> 3.10.0)
|
37
|
+
rspec-expectations (3.10.0)
|
38
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-mocks (3.
|
39
|
+
rspec-support (~> 3.10.0)
|
40
|
+
rspec-mocks (3.10.0)
|
41
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-support (3.
|
44
|
-
rspec_candy (0.
|
42
|
+
rspec-support (~> 3.10.0)
|
43
|
+
rspec-support (3.10.0)
|
44
|
+
rspec_candy (0.5.1)
|
45
45
|
rspec
|
46
46
|
sneaky-save
|
47
|
-
sneaky-save (0.1.
|
47
|
+
sneaky-save (0.1.3)
|
48
48
|
activerecord (>= 3.2.0)
|
49
49
|
thread_safe (0.3.6)
|
50
|
-
tzinfo (1.2.
|
50
|
+
tzinfo (1.2.7)
|
51
51
|
thread_safe (~> 0.1)
|
52
52
|
|
53
53
|
PLATFORMS
|
@@ -57,7 +57,7 @@ DEPENDENCIES
|
|
57
57
|
activerecord (~> 5.1.0)
|
58
58
|
assignable_values!
|
59
59
|
database_cleaner
|
60
|
-
gemika
|
60
|
+
gemika (>= 0.5.0)
|
61
61
|
i18n
|
62
62
|
mysql2
|
63
63
|
rake
|
@@ -65,4 +65,4 @@ DEPENDENCIES
|
|
65
65
|
rspec_candy
|
66
66
|
|
67
67
|
BUNDLED WITH
|
68
|
-
1.
|
68
|
+
2.1.4
|