enumerations 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54447b9967c65df1318cac0ec59daab41b5f41ad118ad0ba32e260b8cbcf36d9
4
- data.tar.gz: fa276b02570956e52d22915957154a125585983c5a2923453d3cc0c6146d908f
3
+ metadata.gz: 34bf65bbe1b914b7d56e3b2ef93b0379deccc09709e37900ea4d6ed8ea97fa3d
4
+ data.tar.gz: da852c0b54ab6c0013564f2b30b0d6df7ccdb1ddd6017c551d078994874f3691
5
5
  SHA512:
6
- metadata.gz: 63e002298b8365cc55c296d85963b3bf410bcd02501394666d45efbfffd3f0fd70a276e9413a51b3a7c81571599f9958a98a3d0b9d5c7671cff60cfd77002591
7
- data.tar.gz: f7e3d0337b42d668fe78a6ea3037ad59820803db1ae65f1ddbcfaf6fcfc1e5d19e6081c0582fc5a1766e27b2c24747901117d78e9f03f2b5e690b87e79a7bb8f
6
+ metadata.gz: ee7e94705e02796314e0f494d6c55231173b76697d34c691e38bc511f7448216306af75fa016558247903210b965a19316fa358210dd83c00ea42e589f05d211
7
+ data.tar.gz: 485c5e53c7dd4b3b5a85c5725f321354e822907fddb64f76c14abeed130c084cd11ea77469376519e08897e594d75b3a5445b7fcc9c7f10c64160f1af344b8df
@@ -9,10 +9,10 @@ on:
9
9
  jobs:
10
10
  test:
11
11
  name: Ruby ${{ matrix.ruby }}
12
- runs-on: ubuntu-18.04
12
+ runs-on: ubuntu-latest
13
13
  strategy:
14
14
  matrix:
15
- ruby: [2.6, 2.7, 3.0]
15
+ ruby: [2.6, 2.7, '3.0', 3.1]
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,6 +1,22 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.5.1](https://github.com/infinum/enumerations/tree/v2.5.1) (YYYY-MM-DD)
3
+ ## [v2.5.2](https://github.com/infinum/enumerations/tree/v2.5.2) (2022-01-27)
4
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.5.1...v2.5.2)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Adds Ruby 3.1 to test suite. Changes the runner to ubuntu-latest.
9
+
10
+ **Closed issues:**
11
+
12
+ - Ruby 3.0, `respond_to? :name` always returns true [\#55](https://github.com/infinum/enumerations/issues/55)
13
+
14
+ **Merged pull requests:**
15
+
16
+ - Initialize `ActiveSupport::Multibyte::Chars` with a String [\#56](https://github.com/infinum/enumerations/pull/56) ([lovro-bikic](https://github.com/lovro-bikic))
17
+ - Test against Ruby 3.1 [\#57](https://github.com/infinum/enumerations/pull/57) ([lovro-bikic](https://github.com/lovro-bikic))
18
+
19
+ ## [v2.5.1](https://github.com/infinum/enumerations/tree/v2.5.1) (2021-05-24)
4
20
  [Full Changelog](https://github.com/infinum/enumerations/compare/v2.5.0...v2.5.1)
5
21
 
6
22
  **Implemented enhancements:**
@@ -126,7 +126,7 @@ module Enumerations
126
126
  attr_reader :symbol, :attributes
127
127
 
128
128
  def initialize(symbol, attributes)
129
- super(symbol)
129
+ super(symbol.to_s)
130
130
 
131
131
  @symbol = symbol
132
132
  @attributes = attributes
@@ -1,3 +1,3 @@
1
1
  module Enumerations
2
- VERSION = '2.5.1'.freeze
2
+ VERSION = '2.5.2'.freeze
3
3
  end
@@ -26,6 +26,12 @@ class EnumerationsTest < Minitest::Test
26
26
  assert_equal 'draft', p.status.to_s
27
27
  end
28
28
 
29
+ def test_model_uniqueness_validation
30
+ p = Post.new(status: :draft)
31
+
32
+ assert_equal true, p.valid?
33
+ end
34
+
29
35
  def test_model_bang_assignment_with_custom_name
30
36
  p = Post.new
31
37
  p.different_status_draft!
@@ -32,6 +32,8 @@ end
32
32
  class Post < ActiveRecord::Base
33
33
  enumeration :status
34
34
  enumeration :different_status, foreign_key: :some_other_status, class_name: 'Status'
35
+
36
+ validates :status, uniqueness: true
35
37
  end
36
38
 
37
39
  class User < ActiveRecord::Base
data/test/value_test.rb CHANGED
@@ -82,4 +82,22 @@ class ValueTest < Minitest::Test
82
82
 
83
83
  assert_equal status.name?, false
84
84
  end
85
+
86
+ def test_enumeration_raises_error_for_nonexistent_attribute
87
+ enum = Class.new(Enumerations::Base) do
88
+ value :foobar
89
+ end
90
+
91
+ assert_raises NoMethodError do
92
+ enum.foobar.name
93
+ end
94
+ end
95
+
96
+ def test_enumeration_does_not_respond_to_nonexistent_attribute
97
+ enum = Class.new(Enumerations::Base) do
98
+ value :foobar
99
+ end
100
+
101
+ assert_equal enum.foobar.respond_to?(:name), false
102
+ end
85
103
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car
@@ -9,7 +9,7 @@ authors:
9
9
  - Nikola Santić
10
10
  - Stjepan Hadjić
11
11
  - Petar Ćurković
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
  date: 2017-09-08 00:00:00.000000000 Z
@@ -158,7 +158,7 @@ files:
158
158
  homepage: https://github.com/infinum/enumerations
159
159
  licenses: []
160
160
  metadata: {}
161
- post_install_message:
161
+ post_install_message:
162
162
  rdoc_options: []
163
163
  require_paths:
164
164
  - lib
@@ -173,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
175
  requirements: []
176
- rubygems_version: 3.0.1
177
- signing_key:
176
+ rubygems_version: 3.3.3
177
+ signing_key:
178
178
  specification_version: 4
179
179
  summary: Enumerations for ActiveRecord!
180
180
  test_files: []