From 8179f8f239712b4a5b26ea4a09ef76cc9e517b0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 18:23:19 +0000 Subject: [PATCH 1/3] chore(deps-dev): bump the bundler-dependencies group with 2 updates Bumps the bundler-dependencies group with 2 updates: [rubocop](https://github.com/rubocop/rubocop) and [webmock](https://github.com/bblimke/webmock). Updates `rubocop` from 1.89.0 to 1.90.0 - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.89.0...v1.90.0) Updates `webmock` from 3.26.2 to 3.26.3 - [Release notes](https://github.com/bblimke/webmock/releases) - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v3.26.2...v3.26.3) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.90.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: bundler-dependencies - dependency-name: webmock dependency-version: 3.26.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: bundler-dependencies ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index df7367a..ab3232c 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ group :development, :test do gem 'railties', '~> 7.1' gem 'rake', '~> 13.4.2' gem 'rspec', '~> 3.13' - gem 'rubocop', '~> 1.89.0' + gem 'rubocop', '~> 1.90.0' gem 'timecop' gem 'tzinfo', '~> 2.0' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index e8ea2d1..3a0026e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -172,8 +172,8 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.7) - rubocop (1.89.0) - json (~> 2.3) + rubocop (1.90.0) + json (>= 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) parallel (>= 1.10) @@ -210,7 +210,7 @@ GEM unicode-emoji (~> 4.1) unicode-emoji (4.2.0) useragent (0.16.11) - webmock (3.26.2) + webmock (3.26.3) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -237,7 +237,7 @@ DEPENDENCIES railties (~> 7.1) rake (~> 13.4.2) rspec (~> 3.13) - rubocop (~> 1.89.0) + rubocop (~> 1.90.0) timecop tzinfo (~> 2.0) webmock @@ -316,7 +316,7 @@ CHECKSUMS rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836 rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47 rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c - rubocop (1.89.0) sha256=4dee8e3ee9c45e474834efd9e8d6fd031e8331c8dacdff0de4ad65ae0a6faae7 + rubocop (1.90.0) sha256=9eb4c065b5c5154e4ef554c547972f3905a9eb6b53e657e580b6796b54bf8242 rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 @@ -333,7 +333,7 @@ CHECKSUMS unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 - webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 + webmock (3.26.3) sha256=77c612816bdcb2fc43db0e42fd98b19be7d4770fd708816fdde65a006664ddec zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH From 0ca334f2060e34763d4a7e0098eba1c69e9e8fcd Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 3 Sep 2026 16:03:36 +0200 Subject: [PATCH 2/3] fix: comply with Style/TimeNow --- lib/posthog/field_parser.rb | 2 +- spec/posthog/client_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/posthog/field_parser.rb b/lib/posthog/field_parser.rb index ecc3b5d..bd4f059 100644 --- a/lib/posthog/field_parser.rb +++ b/lib/posthog/field_parser.rb @@ -134,7 +134,7 @@ def parse_for_alias(fields) # # A new "uuid" is generated when neither "uuid" nor "message_id" is valid. def parse_common_fields(fields) - timestamp = fields[:timestamp] || Time.new + timestamp = fields[:timestamp] || Time.now distinct_id = fields[:distinct_id] send_feature_flags = fields[:send_feature_flags] diff --git a/spec/posthog/client_spec.rb b/spec/posthog/client_spec.rb index 040f7ff..b16a99a 100644 --- a/spec/posthog/client_spec.rb +++ b/spec/posthog/client_spec.rb @@ -438,7 +438,7 @@ def shutdown it 'emits an exact UTC default timestamp when the process timezone is non-UTC' do previous_tz = ENV.fetch('TZ', nil) ENV['TZ'] = 'America/Los_Angeles' - allow(Time).to receive(:new).and_return(Time.local(2024, 1, 2, 3, 4, 5, 123_000)) + allow(Time).to receive(:now).and_return(Time.local(2024, 1, 2, 3, 4, 5, 123_000)) client.capture(event: 'testing the default timestamp', distinct_id: 'joe') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c227ba0..0d129d7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,7 +22,7 @@ type: 'Chocolate', is_a_lie: true, layers: 20, - timestamp: Time.new + timestamp: Time.now } }.freeze From 7a4d54df8bfbf2ef281d3fad8352a8b2bb13f4d0 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 3 Sep 2026 16:08:01 +0200 Subject: [PATCH 3/3] fix: preserve Time.new behavior --- .rubocop.yml | 4 ++++ lib/posthog/field_parser.rb | 2 +- spec/posthog/client_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 47a4e5e..b57466e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,10 @@ AllCops: Style/Documentation: Enabled: false +# Keep Time.new for backwards compatibility with customers that stub or monkey-patch it. +Style/TimeNow: + Enabled: false + Naming/FileName: Exclude: - "posthog-rails/lib/posthog-rails.rb" diff --git a/lib/posthog/field_parser.rb b/lib/posthog/field_parser.rb index bd4f059..ecc3b5d 100644 --- a/lib/posthog/field_parser.rb +++ b/lib/posthog/field_parser.rb @@ -134,7 +134,7 @@ def parse_for_alias(fields) # # A new "uuid" is generated when neither "uuid" nor "message_id" is valid. def parse_common_fields(fields) - timestamp = fields[:timestamp] || Time.now + timestamp = fields[:timestamp] || Time.new distinct_id = fields[:distinct_id] send_feature_flags = fields[:send_feature_flags] diff --git a/spec/posthog/client_spec.rb b/spec/posthog/client_spec.rb index b16a99a..040f7ff 100644 --- a/spec/posthog/client_spec.rb +++ b/spec/posthog/client_spec.rb @@ -438,7 +438,7 @@ def shutdown it 'emits an exact UTC default timestamp when the process timezone is non-UTC' do previous_tz = ENV.fetch('TZ', nil) ENV['TZ'] = 'America/Los_Angeles' - allow(Time).to receive(:now).and_return(Time.local(2024, 1, 2, 3, 4, 5, 123_000)) + allow(Time).to receive(:new).and_return(Time.local(2024, 1, 2, 3, 4, 5, 123_000)) client.capture(event: 'testing the default timestamp', distinct_id: 'joe') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0d129d7..c227ba0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,7 +22,7 @@ type: 'Chocolate', is_a_lie: true, layers: 20, - timestamp: Time.now + timestamp: Time.new } }.freeze