idempotency 0.1.2 → 0.1.3

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: 59512a5938bf9884bd46436ff18078a74c9ed2aafb45ca0c491d1f51fa2f42d7
4
- data.tar.gz: 4965a8b09bc2fa3d2627f79c90f4241ec192a05e7119f2003de8b55f67d394bf
3
+ metadata.gz: 0f09805d7d2ec4b6d8e56f0d6ef0cc298dbe1a7df27e8cc542a45e401792b653
4
+ data.tar.gz: 7117efd37aed82f6e4edea29a2c7b45357262e3e31b2e1a7e348a37521c11af8
5
5
  SHA512:
6
- metadata.gz: 025e20c6912c741e0994d9119d76f67d261a39c4ea8864eb0840e78dc23baf9e0b6454c0dbac31e459f5530465e79fd4823352ee0a717228d3d09386e04d889f
7
- data.tar.gz: 55151ebed4cf89c7ac6e3444439d8c371d31b366e209fe6d17a87ac74ac1bad76921a0dc24f6502b7c5fa7be0e6679f8c22e67e836db5673249ffe7417675216
6
+ metadata.gz: 400b2ed412cad240f18e305c1ce57cc80a96e90f5103db11f1bcb8053734c819c976512058ee9c72eff74891b817524e86d525815b32ef50642670ddffc16a54
7
+ data.tar.gz: e7924c51b71ac88ec1103888f45a43e9aa77da54f84395472b3b188a4c9f443045113d97385b7416c9e1cfb8bd364ed7daf95229c28c9800caf92df83e17cace
@@ -8,10 +8,16 @@ on:
8
8
  jobs:
9
9
  build:
10
10
  runs-on: ubuntu-latest
11
+
12
+ permissions:
13
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
14
+ contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
15
+
11
16
  steps:
12
- - uses: actions/checkout@v3
13
- - name: Release Gem
14
- uses: cadwallion/publish-rubygems-action@master
15
- env:
16
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
17
- RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ bundler-cache: true
22
+ ruby-version: '3.4'
23
+ - uses: rubygems/release-gem@v1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- idempotency (0.1.2)
4
+ idempotency (0.1.3)
5
5
  base64
6
6
  dry-configurable
7
7
  msgpack
data/README.md CHANGED
@@ -89,3 +89,14 @@ end
89
89
 
90
90
  # Render your response
91
91
  ```
92
+
93
+ ### Testing
94
+
95
+ For those using `mock_redis` gem, some methods that `idempotency` gem uses are not implemented (e.g. eval, evalsha), and this could cause test cases to fail. To get around this, the gem has a monkeypatch over `mock_redis` gem to override the missing methods. To use it, simply add following lines to your `spec_helper.rb`:
96
+
97
+ ```ruby
98
+ RSpec.configure do |config|
99
+ config.include Idempotency::Testing::Helpers
100
+ end
101
+ ```
102
+
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'idempotency/cache'
4
+
5
+ class Idempotency
6
+ module Testing
7
+ module Helpers
8
+ def self.included(_base)
9
+ return unless defined?(MockRedis)
10
+
11
+ MockRedis.class_eval do
12
+ def evalsha(sha, keys:, argv:)
13
+ return unless sha == Idempotency::Cache::COMPARE_AND_DEL_SCRIPT_SHA
14
+
15
+ value = argv[0]
16
+ cached_value = get(keys[0])
17
+
18
+ if value == cached_value
19
+ del(keys[0])
20
+ value
21
+ else
22
+ cached_value
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Idempotency
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idempotency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vu Hoang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-07 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -91,6 +91,7 @@ files:
91
91
  - lib/idempotency/constants.rb
92
92
  - lib/idempotency/hanami.rb
93
93
  - lib/idempotency/rails.rb
94
+ - lib/idempotency/testing/helpers.rb
94
95
  - lib/idempotency/version.rb
95
96
  homepage: https://www.ascenda.com
96
97
  licenses: