mirror of
https://github.com/postalserver/postal.git
synced 2026-10-18 18:26:06 +00:00
chore(rails): Upgrade to Rails 8.1.4
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe MigrationWaiter do
|
||||
describe ".wait" do
|
||||
it "returns without waiting when there are no pending migrations" do
|
||||
expect(described_class).not_to receive(:sleep)
|
||||
expect(Process).not_to receive(:exit)
|
||||
described_class.wait
|
||||
end
|
||||
|
||||
it "exits after all attempts have been used while migrations are still pending" do
|
||||
stub_const("MigrationWaiter::ATTEMPTS", 2)
|
||||
allow_any_instance_of(ActiveRecord::Migrator).to receive(:pending_migrations).and_return([double])
|
||||
expect(described_class).to receive(:sleep).once
|
||||
expect(Process).to receive(:exit).with(1).and_raise(SystemExit)
|
||||
expect { described_class.wait }.to raise_error(SystemExit)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,38 @@
|
||||
# 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
|
||||
@@ -1,5 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: http_endpoints
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# disabled_until :datetime
|
||||
# encoding :string(255)
|
||||
# error :text(65535)
|
||||
# format :string(255)
|
||||
# include_attachments :boolean default(TRUE)
|
||||
# last_used_at :datetime
|
||||
# name :string(255)
|
||||
# strip_replies :boolean default(FALSE)
|
||||
# timeout :integer
|
||||
# url :string(255)
|
||||
# uuid :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# server_id :integer
|
||||
#
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe HTTPEndpoint do
|
||||
|
||||
Reference in New Issue
Block a user