nxt_support 0.6.0 → 0.6.2

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: 66ed3b4123cb69e9349dfa49defe2638941a0930742ce6bdbf34b914fdfc356e
4
- data.tar.gz: 2e33ea8ec3a80541b32fea89bf981146059f21e5ca308804c3949447a5a69749
3
+ metadata.gz: e8b3ca68f9a536c651b5e6dcbe23ca93353e751a6e82b0dfe8cc34c2fe5f2e6b
4
+ data.tar.gz: d000a20b0f8c8036bb6b92736429214c4a575031dca1ca2bf0131011e0dbf450
5
5
  SHA512:
6
- metadata.gz: d6e3ada3b804d951258a3460e1df1a6649a0f125143f593f8eec50b9938966d0aa150e10bcb69da6bc262a44a8bdaea195d75a7945d27e5a86f5c8ee93561862
7
- data.tar.gz: e5db5071d06af06a9c5c7da33e590404342500d9fa68d50e98a0d6b2fb89e5512794a2c6b62f4c34b361299fc7b45e22f3081bdcd1ad67e6a74f40fc351c4f26
6
+ metadata.gz: 6183e37bab247fb40afee92b55c695b233428b91cadcfd30a6f36df07ba8856f72859cddebba385f70c16afe0e789306505fe69c809ef8852de8e2b241db981a
7
+ data.tar.gz: 8a9405cd61a678f51510dfdf97a986d017fd3fb399e4c0aa56358245601ba0670621f81e5a32df912b4c1b1c489436dd98e4a2516871cfd173f2e9786cfe4535
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ tests:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby-version: ["3.3", "3.4", "4.0"]
18
+ steps:
19
+ - uses: actions/checkout@v6
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+ - run: bundle exec rspec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.5
1
+ 4.0.3
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 4.0.3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.6.2 2026-04-30
2
+ - Fix `.validate_duration` and `.validates_durations` when used in combination with `duration_attribute_accessor`
3
+
4
+ # v0.6.1 2026-04-30
5
+ - Added `.validate_duration` and `.validates_durations` to `NxtSupport::DurationAttributeAccessor`
6
+
1
7
  # v0.6.0 2024-09-27
2
8
  - Added `NxtSupport::Uuid`
3
9
 
data/Gemfile CHANGED
@@ -2,7 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in nxt_support.gemspec
4
4
  gemspec
5
-
6
- group :test do
7
- gem 'rspec_junit_formatter' # for CircleCI
8
- end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_support (0.6.0)
4
+ nxt_support (0.6.2)
5
5
  activerecord
6
6
  activesupport
7
7
  nxt_init
@@ -10,65 +10,74 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (7.2.1)
14
- activesupport (= 7.2.1)
15
- activerecord (7.2.1)
16
- activemodel (= 7.2.1)
17
- activesupport (= 7.2.1)
13
+ activemodel (8.1.3)
14
+ activesupport (= 8.1.3)
15
+ activerecord (8.1.3)
16
+ activemodel (= 8.1.3)
17
+ activesupport (= 8.1.3)
18
18
  timeout (>= 0.4.0)
19
- activesupport (7.2.1)
19
+ activesupport (8.1.3)
20
20
  base64
21
21
  bigdecimal
22
22
  concurrent-ruby (~> 1.0, >= 1.3.1)
23
23
  connection_pool (>= 2.2.5)
24
24
  drb
25
25
  i18n (>= 1.6, < 2)
26
+ json
26
27
  logger (>= 1.4.2)
27
28
  minitest (>= 5.1)
28
29
  securerandom (>= 0.3)
29
30
  tzinfo (~> 2.0, >= 2.0.5)
30
- base64 (0.2.0)
31
- bigdecimal (3.1.8)
31
+ uri (>= 0.13.1)
32
+ base64 (0.3.0)
33
+ bigdecimal (4.1.2)
32
34
  coderay (1.1.3)
33
- concurrent-ruby (1.3.4)
34
- connection_pool (2.4.1)
35
- diff-lcs (1.5.0)
36
- drb (2.2.1)
37
- i18n (1.14.6)
35
+ concurrent-ruby (1.3.6)
36
+ connection_pool (3.0.2)
37
+ diff-lcs (1.6.2)
38
+ drb (2.2.3)
39
+ i18n (1.14.8)
38
40
  concurrent-ruby (~> 1.0)
39
- logger (1.6.1)
40
- method_source (1.0.0)
41
- mini_portile2 (2.8.4)
42
- minitest (5.25.1)
41
+ io-console (0.8.2)
42
+ json (2.19.4)
43
+ logger (1.7.0)
44
+ method_source (1.1.0)
45
+ mini_portile2 (2.8.9)
46
+ minitest (6.0.5)
47
+ drb (~> 2.0)
48
+ prism (~> 1.5)
43
49
  nxt_init (0.1.5)
44
50
  activesupport
45
51
  nxt_registry (0.3.10)
46
52
  activesupport
47
- pry (0.14.2)
53
+ prism (1.9.0)
54
+ pry (0.16.0)
48
55
  coderay (~> 1.1)
49
56
  method_source (~> 1.0)
50
- rake (13.0.6)
51
- rspec (3.12.0)
52
- rspec-core (~> 3.12.0)
53
- rspec-expectations (~> 3.12.0)
54
- rspec-mocks (~> 3.12.0)
55
- rspec-core (3.12.2)
56
- rspec-support (~> 3.12.0)
57
- rspec-expectations (3.12.3)
57
+ reline (>= 0.6.0)
58
+ rake (13.4.2)
59
+ reline (0.6.3)
60
+ io-console (~> 0.5)
61
+ rspec (3.13.2)
62
+ rspec-core (~> 3.13.0)
63
+ rspec-expectations (~> 3.13.0)
64
+ rspec-mocks (~> 3.13.0)
65
+ rspec-core (3.13.6)
66
+ rspec-support (~> 3.13.0)
67
+ rspec-expectations (3.13.5)
58
68
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.12.0)
60
- rspec-mocks (3.12.6)
69
+ rspec-support (~> 3.13.0)
70
+ rspec-mocks (3.13.8)
61
71
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.12.0)
63
- rspec-support (3.12.1)
64
- rspec_junit_formatter (0.6.0)
65
- rspec-core (>= 2, < 4, != 2.12.0)
66
- securerandom (0.3.1)
67
- sqlite3 (1.6.4)
72
+ rspec-support (~> 3.13.0)
73
+ rspec-support (3.13.7)
74
+ securerandom (0.4.1)
75
+ sqlite3 (2.9.3)
68
76
  mini_portile2 (~> 2.8.0)
69
- timeout (0.4.1)
77
+ timeout (0.6.1)
70
78
  tzinfo (2.0.6)
71
79
  concurrent-ruby (~> 1.0)
80
+ uri (1.1.1)
72
81
 
73
82
  PLATFORMS
74
83
  ruby
@@ -79,8 +88,7 @@ DEPENDENCIES
79
88
  pry
80
89
  rake
81
90
  rspec
82
- rspec_junit_formatter
83
91
  sqlite3
84
92
 
85
93
  BUNDLED WITH
86
- 2.2.25
94
+ 4.0.8
@@ -19,6 +19,18 @@ module NxtSupport
19
19
  define_duration_attribute_writer(attr_name)
20
20
  end
21
21
  end
22
+
23
+ def validates_durations(*attrs, **opts)
24
+ validates_each(*attrs, **opts) do |record, attr, value|
25
+ next if value.is_a?(ActiveSupport::Duration)
26
+ next if record.is_valid_iso8601_duration?(value)
27
+ record.errors.add attr, "is not a valid iso8601 duration."
28
+ end
29
+ end
30
+
31
+ def validates_duration(attr, **opts)
32
+ validates_durations(attr, **opts)
33
+ end
22
34
 
23
35
  private
24
36
 
@@ -55,7 +67,7 @@ module NxtSupport
55
67
  def is_valid_iso8601_duration?(string)
56
68
  ActiveSupport::Duration.parse(string)
57
69
  true
58
- rescue ActiveSupport::Duration::ISO8601Parser::ParsingError
70
+ rescue ActiveSupport::Duration::ISO8601Parser::ParsingError, TypeError
59
71
  false
60
72
  end
61
73
  end
@@ -1,3 +1,3 @@
1
1
  module NxtSupport
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.6.2".freeze
3
3
  end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxt_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nils Sommer
8
8
  - Andreas Robecke
9
9
  - Nicolai Stoianov
10
10
  - Akihiko Ito
11
- autorequire:
12
11
  bindir: exe
13
12
  cert_chain: []
14
- date: 2024-10-07 00:00:00.000000000 Z
13
+ date: 1980-01-02 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: activerecord
@@ -139,7 +138,6 @@ dependencies:
139
138
  - - ">="
140
139
  - !ruby/object:Gem::Version
141
140
  version: '0'
142
- description:
143
141
  email:
144
142
  - mail@nilssommer.de
145
143
  - a.robecke@getsafe.de
@@ -149,11 +147,12 @@ executables: []
149
147
  extensions: []
150
148
  extra_rdoc_files: []
151
149
  files:
152
- - ".circleci/config.yml"
153
150
  - ".editorconfig"
151
+ - ".github/workflows/ci.yml"
154
152
  - ".gitignore"
155
153
  - ".rspec"
156
154
  - ".ruby-version"
155
+ - ".tool-versions"
157
156
  - CHANGELOG.md
158
157
  - Gemfile
159
158
  - Gemfile.lock
@@ -201,7 +200,6 @@ metadata:
201
200
  homepage_uri: https://github.com/nxt-insurance/nxt_support
202
201
  source_code_uri: https://github.com/nxt-insurance/nxt_support
203
202
  changelog_uri: https://github.com/nxt-insurance/nxt_support/CHANGELOG.md
204
- post_install_message:
205
203
  rdoc_options: []
206
204
  require_paths:
207
205
  - lib
@@ -216,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
214
  - !ruby/object:Gem::Version
217
215
  version: '0'
218
216
  requirements: []
219
- rubygems_version: 3.5.9
220
- signing_key:
217
+ rubygems_version: 4.0.6
221
218
  specification_version: 4
222
219
  summary: Support through reusable Mixins and Helpers for Ruby on Rails Applications
223
220
  test_files: []
data/.circleci/config.yml DELETED
@@ -1,53 +0,0 @@
1
- # Ruby CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
- #
5
- version: 2.1
6
-
7
- workflows:
8
- build:
9
- jobs:
10
- - build:
11
- matrix:
12
- parameters:
13
- ruby-version: ["3.1.3", "3.2.1", "3.2.2"]
14
- orbs:
15
- ruby: circleci/ruby@2.0.1
16
-
17
- jobs:
18
- build:
19
- parameters:
20
- ruby-version:
21
- type: string
22
-
23
- docker:
24
- # specify the version you desire here
25
- - image: cimg/ruby:<< parameters.ruby-version >>
26
-
27
- working_directory: ~/repo
28
-
29
- steps:
30
- - checkout
31
- - ruby/install-deps:
32
- key: gems-v2
33
- include-branch-in-cache-key: false
34
- - run:
35
- name: run tests
36
- command: |
37
- mkdir /tmp/test-results
38
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
39
- circleci tests split --split-by=timings)"
40
-
41
- bundle exec rspec \
42
- --format progress \
43
- --format RspecJunitFormatter \
44
- --out /tmp/test-results/rspec.xml \
45
- --format progress \
46
- $TEST_FILES
47
-
48
- # collect reports
49
- - store_test_results:
50
- path: /tmp/test-results
51
- - store_artifacts:
52
- path: /tmp/test-results
53
- destination: test-results