mirror of
https://github.com/postalserver/postal.git
synced 2026-12-05 15:55:50 +00:00
* chore(rails): Upgrade to Rails 8.1.4 * chore(rails): Upgrade to Rails 8.1.4 * chore(deps): upgrade rails to 8.1.4.1 Rails 8.1.4.1 is a security release for the 8.1 line. This also changes how Rails is constrained in the Gemfile. Previous upgrades have always pinned an exact version (e.g. "= 7.1.6"); this uses "~> 8.1.4", ">= 8.1.4.1" instead: - "~> 8.1.4" accepts any 8.1.x release from 8.1.4 onwards, but not 8.2. Later patch and security releases can be taken with `bundle update rails` without editing the Gemfile, while moving to a new minor version remains a deliberate change. - ">= 8.1.4.1" stops the constraint resolving to any version older than the fixes in this release. The installed version is still fixed by Gemfile.lock, so builds remain reproducible. The Gemfile now states which versions are acceptable rather than repeating what the lockfile already pins. --------- Co-authored-by: Richard Patching <richard@justaddpixels.com>
39 lines
1.3 KiB
Ruby
39 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
module Worker
|
|
|
|
RSpec.describe Process do
|
|
subject(:process) { described_class.new(thread_count: 1) }
|
|
|
|
before do
|
|
# Each process registers its metrics so each example needs its own registry
|
|
allow(Prometheus::Client).to receive(:registry).and_return(Prometheus::Client::Registry.new)
|
|
|
|
# Errors are normally logged and swallowed, raise them so they fail the example instead
|
|
allow(process).to receive(:capture_errors).and_yield
|
|
end
|
|
|
|
describe "#work" do
|
|
it "runs each job and returns false when there was no work to do" do
|
|
expect(process.send(:work, 0)).to be false
|
|
end
|
|
end
|
|
|
|
describe "#run_task" do
|
|
it "runs a task which is due and schedules its next run" do
|
|
scheduled_task = ScheduledTask.create!(name: "PruneWebhookRequestsScheduledTask", next_run_after: 1.minute.ago)
|
|
task = instance_double(PruneWebhookRequestsScheduledTask, call: nil)
|
|
allow(PruneWebhookRequestsScheduledTask).to receive(:new).and_return(task)
|
|
|
|
process.send(:run_task, PruneWebhookRequestsScheduledTask)
|
|
|
|
expect(task).to have_received(:call)
|
|
expect(scheduled_task.reload.next_run_after).to be > Time.current
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|