Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/models/release_spec.rb
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/models/release_spec.rb')
-rw-r--r--spec/models/release_spec.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb
index 540a8068b20..b88813b3328 100644
--- a/spec/models/release_spec.rb
+++ b/spec/models/release_spec.rb
@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe Release do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository) }
+
let(:release) { create(:release, project: project, author: user) }
it { expect(release).to be_valid }
@@ -37,6 +38,18 @@ RSpec.describe Release do
end
end
+ context 'when description of a release is longer than the limit' do
+ let(:description) { 'a' * (Gitlab::Database::MAX_TEXT_SIZE_LIMIT + 1) }
+ let(:release) { build(:release, project: project, description: description) }
+
+ it 'creates a validation error' do
+ release.validate
+
+ expect(release.errors.full_messages)
+ .to include("Description is too long (maximum is #{Gitlab::Database::MAX_TEXT_SIZE_LIMIT} characters)")
+ end
+ end
+
context 'when a release is tied to a milestone for another project' do
it 'creates a validation error' do
milestone = build(:milestone, project: create(:project))
@@ -53,7 +66,7 @@ RSpec.describe Release do
end
describe '#assets_count' do
- subject { release.assets_count }
+ subject { Release.find(release.id).assets_count }
it 'returns the number of sources' do
is_expected.to eq(Gitlab::Workhorse::ARCHIVE_FORMATS.count)
@@ -67,7 +80,7 @@ RSpec.describe Release do
end
it "excludes sources count when asked" do
- assets_count = release.assets_count(except: [:sources])
+ assets_count = Release.find(release.id).assets_count(except: [:sources])
expect(assets_count).to eq(1)
end
end