enumerize 2.2.1 → 2.5.0

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +73 -0
  3. data/CHANGELOG.md +35 -1
  4. data/Gemfile +2 -3
  5. data/Gemfile.global +2 -10
  6. data/Gemfile.mongo_mapper +2 -3
  7. data/Gemfile.rails60 +6 -0
  8. data/Gemfile.rails61 +6 -0
  9. data/Gemfile.rails70 +9 -0
  10. data/Gemfile.railsmaster +5 -0
  11. data/README.md +205 -94
  12. data/Rakefile +2 -0
  13. data/lib/enumerize/activemodel.rb +2 -0
  14. data/lib/enumerize/activerecord.rb +36 -2
  15. data/lib/enumerize/attribute.rb +19 -11
  16. data/lib/enumerize/attribute_map.rb +2 -0
  17. data/lib/enumerize/base.rb +6 -6
  18. data/lib/enumerize/hooks/formtastic.rb +4 -1
  19. data/lib/enumerize/hooks/sequel_dataset.rb +2 -0
  20. data/lib/enumerize/hooks/simple_form.rb +4 -1
  21. data/lib/enumerize/hooks/uniqueness.rb +2 -0
  22. data/lib/enumerize/integrations/rails_admin.rb +2 -0
  23. data/lib/enumerize/integrations/rspec/matcher.rb +7 -2
  24. data/lib/enumerize/integrations/rspec.rb +2 -0
  25. data/lib/enumerize/module.rb +2 -0
  26. data/lib/enumerize/module_attributes.rb +2 -0
  27. data/lib/enumerize/mongoid.rb +16 -0
  28. data/lib/enumerize/predicatable.rb +3 -1
  29. data/lib/enumerize/predicates.rb +2 -0
  30. data/lib/enumerize/scope/activerecord.rb +16 -0
  31. data/lib/enumerize/scope/mongoid.rb +15 -0
  32. data/lib/enumerize/scope/sequel.rb +16 -0
  33. data/lib/enumerize/sequel.rb +9 -4
  34. data/lib/enumerize/set.rb +2 -0
  35. data/lib/enumerize/utils.rb +12 -0
  36. data/lib/enumerize/value.rb +14 -15
  37. data/lib/enumerize/version.rb +1 -1
  38. data/lib/enumerize.rb +4 -0
  39. data/lib/sequel/plugins/enumerize.rb +2 -0
  40. data/spec/enumerize/integrations/rspec/matcher_spec.rb +13 -10
  41. data/spec/spec_helper.rb +2 -0
  42. data/test/activemodel_test.rb +24 -22
  43. data/test/activerecord_test.rb +229 -92
  44. data/test/attribute_map_test.rb +9 -7
  45. data/test/attribute_test.rb +37 -30
  46. data/test/base_test.rb +38 -36
  47. data/test/formtastic_test.rb +17 -0
  48. data/test/module_attributes_test.rb +10 -8
  49. data/test/mongo_mapper_test.rb +19 -10
  50. data/test/mongoid_test.rb +51 -22
  51. data/test/multiple_test.rb +15 -7
  52. data/test/predicates_test.rb +20 -18
  53. data/test/rails_admin_test.rb +4 -2
  54. data/test/sequel_test.rb +100 -47
  55. data/test/set_test.rb +25 -23
  56. data/test/simple_form_test.rb +17 -0
  57. data/test/support/mock_controller.rb +2 -0
  58. data/test/support/shared_enums.rb +43 -0
  59. data/test/support/view_test_helper.rb +14 -1
  60. data/test/test_helper.rb +2 -0
  61. data/test/value_test.rb +51 -30
  62. metadata +11 -30
  63. data/.travis.yml +0 -35
  64. data/Gemfile.rails42 +0 -7
  65. data/Gemfile.rails50 +0 -7
  66. data/Gemfile.rails52 +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7398da2a4b6b495fe048cf6872660b0c8ac55278197f0f31e04e6de360691152
4
- data.tar.gz: 88d7a066d937fa8654b9878a85d16d2ac4f9048be29e211ba26d828967c60041
3
+ metadata.gz: c86135927c636fc672bb7371b83b78b6844716f70dd2b9fa19a255b35ce2a5ca
4
+ data.tar.gz: d1ac5ff95c2673d0743fab97725cf7abc939b157594545ad3e40dd9a1eefb841
5
5
  SHA512:
6
- metadata.gz: 14ef4618d73da931a8cfeae83a9d650c9ae98d5bf876bdc72b151e182bbb345c86fe7fe495f8f096f61f170a75b29a12478b7f02081d277cd467c541bf2bf158
7
- data.tar.gz: d8868aa8ac94d9920de256382460f2ea36343a72b89b9aa46ce0369248b940602c27014da4ff7fbee411d43b7eb0ada4442866857ae779414d0fdd0f57902a60
6
+ metadata.gz: 811f624a3f6d92fa20bc988b80051103e441315eab1662f3f2b1b9b98a866984e247e1b823669a7f7645d13e5aa44aaf8e1e95e39294e8c27a28d96dfc87b572
7
+ data.tar.gz: 8c50e7946135c94719ac50149ab55ad1601d508b9cdf663e4542f220655b611899824af77a60873601d2193b01fc2611735f643c51d07d8d188213b478123149
@@ -0,0 +1,73 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-20.04
12
+ services:
13
+ mongodb:
14
+ image: mongo:latest
15
+ ports:
16
+ - 27017:27017
17
+ postgres:
18
+ image: postgres:12
19
+ env:
20
+ POSTGRES_USER: postgres
21
+ POSTGRES_PASSWORD: postgres
22
+ ports:
23
+ - 5432:5432
24
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
25
+ mysql:
26
+ image: mysql:5.6
27
+ env:
28
+ MYSQL_ROOT_PASSWORD: mysql
29
+ ports:
30
+ - 3306:3306
31
+ options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ ruby-version: ['2.6', '2.7', '3.0.2']
36
+ gemfile:
37
+ - Gemfile
38
+ - Gemfile.rails60
39
+ - Gemfile.rails61
40
+ - Gemfile.rails70
41
+ - Gemfile.railsmaster
42
+ - Gemfile.mongo_mapper
43
+ db:
44
+ - sqlite3
45
+ - postgresql
46
+ - mysql2
47
+ exclude:
48
+ - gemfile: Gemfile.mongo_mapper
49
+ db: postgresql
50
+ - ruby-version: '3.0.2'
51
+ gemfile: Gemfile
52
+ - ruby-version: '3.0.2'
53
+ gemfile: Gemfile.mongo_mapper
54
+ - ruby-version: '2.6'
55
+ gemfile: Gemfile.rails70
56
+ - ruby-version: '2.6'
57
+ gemfile: Gemfile.railsmaster
58
+ env:
59
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
60
+ DB: "${{ matrix.db }}"
61
+ steps:
62
+ - uses: actions/checkout@v2
63
+ - name: Set up Ruby
64
+ uses: ruby/setup-ruby@v1
65
+ with:
66
+ ruby-version: ${{ matrix.ruby-version }}
67
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
68
+ - name: Run tests
69
+ run: bundle exec rake
70
+ env:
71
+ POSTGRES_USER: postgres
72
+ POSTGRES_PASSWORD: postgres
73
+ MYSQL_ROOT_PASSWORD: mysql
data/CHANGELOG.md CHANGED
@@ -1,9 +1,43 @@
1
- ## master
1
+ ## 2.5.0 (December 24, 2021)
2
2
 
3
3
  ### enhancements
4
4
 
5
+ * Add support for Rails 7.0.0.alpha. (by [@f-mer](https://github.com/f-mer))
6
+ * Add support for negative shallow scopes. (by [@nashby](https://github.com/nashby))
7
+
8
+ ## 2.4.0 (December 12, 2020)
9
+
10
+ ### enhancements
11
+
12
+ * Show warning when enumerized value name conflicts with existing object's methods. (by [@aki77](https://github.com/aki77))
13
+ * Add RSpec support for shallow scopes. (by [@nashby](https://github.com/nashby))
14
+ * Drop support for Ruby older than 2.5. Support only Ruby 2.5+. (by [@nashby](https://github.com/nashby))
15
+ * Drop support for Rails 4. Support only Rails 5.2+. (by [@nashby](https://github.com/nashby))
16
+ * Add support for Rails 6.1 (by [@y-yagi](https://github.com/y-yagi))
17
+
5
18
  ### bug fix
6
19
 
20
+ * Fix exception when using predicate methods on enumerized value transformed into invalid value. (by [@guigs](https://github.com/guigs))
21
+ * Fix issue with RSpec#with_predicates matcher when custom values are used as attribute. (by [@nashby](https://github.com/nashby))
22
+
23
+ ## 2.3.1 (May 2, 2019)
24
+
25
+ ### enhancements
26
+
27
+ * Add ability to skip validations by passing `:skip_validations` option. (by [@chumakoff](https://github.com/chumakoff))
28
+ * Add option `scope: shallow` to extend scopes based on enumerized attribute values (by [@moofkit](https://github.com/moofkit/))
29
+
30
+ ### bug fix
31
+
32
+ * Fix issue with ActiveRecord and Mongoid `reload` method when enumberized attributes weren't synced from DB. (by [@nashby](https://github.com/nashby) and [@FunkyloverOne](https://github.com/FunkyloverOne))
33
+ * Fix issue with ActiveRecord `reload` method not working for ActiveRecord::Store attributes due to `1b776c`. (by [@rickcsong](https://github.com/rickcsong))
34
+
35
+ ## 2.2.2 (March 6, 2018)
36
+
37
+ ### bug fix
38
+
39
+ * Support non-ActiveModel objects in SimpleForm/Formtastic integration. (by [@nashby](https://github.com/nashby))
40
+
7
41
  ## 2.2.1 (February 15, 2018)
8
42
 
9
43
  ### bug fix
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  eval_gemfile('Gemfile.global')
2
2
 
3
3
  gem 'minitest', '~> 5.8'
4
- gem 'rails', '5.1.4', require: false
5
- gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0', platform: :jruby
6
- gem 'activerecord-jdbcpostgresql-adapter', '~> 51.0', platform: :jruby
4
+ gem 'rails', '~> 5.2.4', require: false
7
5
  gem 'mongoid'
6
+ gem 'sqlite3', '~> 1.3.6', :platform => [:ruby, :mswin, :mingw]
data/Gemfile.global CHANGED
@@ -5,16 +5,8 @@ gemspec
5
5
  gem 'rake'
6
6
  gem 'rspec', :require => false
7
7
 
8
- gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
9
- gem 'pg', '~> 0.21.0', :platform => [:ruby, :mswin, :mingw]
8
+ gem 'pg', '~> 1.2.3', :platform => [:ruby, :mswin, :mingw]
10
9
  gem 'sequel'
11
-
12
- platforms :rbx do
13
- gem 'rubysl', '~> 2.0'
14
- gem 'psych'
15
- gem 'rubinius-developer_tools'
16
- gem 'rubysl-test-unit'
17
- end
18
-
19
10
  gem 'simple_form'
20
11
  gem 'formtastic'
12
+ gem 'mysql2'
data/Gemfile.mongo_mapper CHANGED
@@ -1,7 +1,6 @@
1
1
  eval_gemfile('Gemfile.global')
2
2
 
3
3
  gem 'minitest', '~> 5.8'
4
- gem 'rails', '4.2.8', :require => false
5
- gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3.0', platform: :jruby
6
- gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.0', platform: :jruby
4
+ gem 'rails', '~> 5.2.4', :require => false
7
5
  gem 'mongo_mapper'
6
+ gem 'sqlite3', '~> 1.3.6', :platform => [:ruby, :mswin, :mingw]
data/Gemfile.rails60 ADDED
@@ -0,0 +1,6 @@
1
+ eval_gemfile('Gemfile.global')
2
+
3
+ gem 'minitest', '~> 5.8'
4
+ gem 'rails', '~> 6.0.0', require: false
5
+ gem 'mongoid', github: 'mongodb/mongoid'
6
+ gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
data/Gemfile.rails61 ADDED
@@ -0,0 +1,6 @@
1
+ eval_gemfile('Gemfile.global')
2
+
3
+ gem 'minitest', '~> 5.8'
4
+ gem 'rails', github: 'rails/rails', branch: '6-1-stable', require: false
5
+ gem 'mongoid', github: 'mongodb/mongoid'
6
+ gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
data/Gemfile.rails70 ADDED
@@ -0,0 +1,9 @@
1
+ eval_gemfile('Gemfile.global')
2
+
3
+ gem 'minitest', '~> 5.8'
4
+ gem 'rails', github: 'rails/rails', branch: '7-0-stable', require: false
5
+
6
+ # TODO: Mongoid doesn't support Rails 7 yet. Uncomment when it's fixed https://jira.mongodb.org/browse/MONGOID-5193
7
+ # gem 'mongoid', github: 'mongodb/mongoid'
8
+
9
+ gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
@@ -0,0 +1,5 @@
1
+ eval_gemfile('Gemfile.global')
2
+
3
+ gem 'minitest', '~> 5.8'
4
+ gem 'rails', github: 'rails/rails', branch: 'main', require: false
5
+ gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]