Files
postal/spec/models/http_endpoint_spec.rb
Richard PatchingandRichard Patching ea23d929cf chore: upgrade to rails 8.1.4 (#3659)
* 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>
2026-11-16 14:44:43 +00:00

59 lines
1.5 KiB
Ruby

# 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
describe "validations" do
subject(:endpoint) { build(:http_endpoint, url: url) }
[
"https://example.com/messages/~user;v=1?token=a+b#section",
"http://example.com:8080/path?x=1&y=2",
"https://[2606:2800:220:1:248:1893:25c8:1946]/hook",
].each do |valid_url|
context "with #{valid_url}" do
let(:url) { valid_url }
it "is valid" do
expect(endpoint).to be_valid
end
end
end
[
"ftp://example.com/hook",
"https:///missing-host",
"not a url",
].each do |invalid_url|
context "with #{invalid_url}" do
let(:url) { invalid_url }
it "is invalid" do
expect(endpoint).not_to be_valid
expect(endpoint.errors[:url]).to be_present
end
end
end
end
end