diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-16 15:07:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-16 15:07:11 +0300 |
commit | d87800c3cfa21bde64704542d61a587c5ff4306e (patch) | |
tree | 4921659e458ef0b21a637ba68a2765c93e4f20b7 /spec/models | |
parent | 8ae36d93f1a63874b584f0488fde88c1fee999c4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/spammable_spec.rb | 14 | ||||
-rw-r--r-- | spec/models/packages/nuget/metadatum_spec.rb | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/concerns/spammable_spec.rb b/spec/models/concerns/spammable_spec.rb index a18a4b067dd..8a2fa6675e5 100644 --- a/spec/models/concerns/spammable_spec.rb +++ b/spec/models/concerns/spammable_spec.rb @@ -97,6 +97,20 @@ RSpec.describe Spammable, feature_category: :instance_resiliency do .to match_array /Your #{subject.class.model_name.human.downcase} has been recognized as spam./ end end + + context 'when the spammable model is a Note' do + subject do + Note.new.tap do |m| + m.spam! + m.invalidate_if_spam + end + end + + it 'has an error related to spam on the model' do + expect(subject.errors.messages[:base]) + .to match_array /Your comment has been recognized as spam./ + end + end end context 'when the model needs recaptcha' do diff --git a/spec/models/packages/nuget/metadatum_spec.rb b/spec/models/packages/nuget/metadatum_spec.rb index 6c652f78849..4b02353d6e8 100644 --- a/spec/models/packages/nuget/metadatum_spec.rb +++ b/spec/models/packages/nuget/metadatum_spec.rb @@ -21,6 +21,7 @@ RSpec.describe Packages::Nuget::Metadatum, type: :model, feature_category: :pack it { is_expected.to allow_value('https://sandbox.com').for(url) } it { is_expected.not_to allow_value('123').for(url) } it { is_expected.not_to allow_value('sandbox.com').for(url) } + it { is_expected.to validate_length_of(url).is_at_most(described_class::MAX_URL_LENGTH) } end describe '#ensure_nuget_package_type' do |