From 2fa7f839d8405e80f798c14b732d0de8c1cc41a2 Mon Sep 17 00:00:00 2001 From: Ben Lovell Date: Fri, 17 May 2024 12:20:52 +0100 Subject: [PATCH] Increase allowed website lengths to 300 --- app/models/firm.rb | 2 +- app/models/office.rb | 2 +- spec/models/firm_spec.rb | 4 ++-- spec/models/office_spec.rb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/firm.rb b/app/models/firm.rb index 4ecb3976..4d9f6ca8 100644 --- a/app/models/firm.rb +++ b/app/models/firm.rb @@ -61,7 +61,7 @@ def self.languages_used with_options on: :update do |firm| firm.validates :website_address, allow_blank: true, - length: { maximum: 120 }, + length: { maximum: 300 }, format: { with: /\A(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]+/ } firm.validates :free_initial_meeting, diff --git a/app/models/office.rb b/app/models/office.rb index bc4bacc9..f6d5d352 100644 --- a/app/models/office.rb +++ b/app/models/office.rb @@ -43,7 +43,7 @@ class Office < ApplicationRecord validates :website, allow_blank: true, - length: { maximum: 100 }, + length: { maximum: 300 }, format: { with: /\A(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]+/ } validates :disabled_access, inclusion: { in: [true, false] } diff --git a/spec/models/firm_spec.rb b/spec/models/firm_spec.rb index ad2fa53f..d946c150 100644 --- a/spec/models/firm_spec.rb +++ b/spec/models/firm_spec.rb @@ -189,8 +189,8 @@ def set_marker_field(firm, value) context 'on update' do describe 'website_address' do - it 'must not exceed 120 characters' do - firm.website_address = "#{'a' * 120}.com" + it 'must not exceed 300 characters' do + firm.website_address = "#{'a' * 300}.com" expect(firm).to_not be_valid end diff --git a/spec/models/office_spec.rb b/spec/models/office_spec.rb index 9bf1f364..fd928ac3 100644 --- a/spec/models/office_spec.rb +++ b/spec/models/office_spec.rb @@ -149,8 +149,8 @@ end describe 'website url' do - it 'must not exceed 100 characters' do - office.website = "#{'a' * 100}.com" + it 'must not exceed 300 characters' do + office.website = "#{'a' * 300}.com" expect(office).to_not be_valid end