diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-13 02:03:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-13 02:03:36 +0300 |
commit | cffe7caa43575aead057d8779827bada786f84b6 (patch) | |
tree | 0782bf1cd66a7753caabafb10ab3feb15a5c1d2f /spec/models | |
parent | 734bfe3a2e8b86c3e049f6f13d380b3d30e4e359 (diff) |
Add latest changes from gitlab-org/security/gitlab@16-6-stable-ee
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/issue_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/timelog_spec.rb | 47 |
3 files changed, 0 insertions, 57 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 594492a160d..6c8603d7b4c 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -1036,11 +1036,6 @@ RSpec.describe Issue, feature_category: :team_planning do end end - it_behaves_like 'a time trackable' do - let(:trackable) { create(:issue) } - let(:timelog) { create(:issue_timelog, issue: trackable) } - end - it_behaves_like 'an editable mentionable' do subject { create(:issue, project: create(:project, :repository)) } diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 1c6a29f065f..d3c32da2842 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -2058,11 +2058,6 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev end end - it_behaves_like 'a time trackable' do - let(:trackable) { create(:merge_request, :simple, source_project: create(:project, :repository)) } - let(:timelog) { create(:merge_request_timelog, merge_request: trackable) } - end - it_behaves_like 'an editable mentionable' do subject { create(:merge_request, :simple, source_project: create(:project, :repository)) } diff --git a/spec/models/timelog_spec.rb b/spec/models/timelog_spec.rb index aee2c4ded19..4f2f16875b8 100644 --- a/spec/models/timelog_spec.rb +++ b/spec/models/timelog_spec.rb @@ -46,53 +46,6 @@ RSpec.describe Timelog, feature_category: :team_planning do expect(subject).to be_valid end - describe 'check if total time spent would be within the set range' do - let_it_be(:time_already_spent) { 1.minute.to_i } - - before_all do - create(:issue_timelog, issue: issue, time_spent: time_already_spent) - end - - it 'is valid when a negative time spent offsets the time already spent' do - timelog = build(:issue_timelog, issue: issue, time_spent: -time_already_spent) - - expect(timelog).to be_valid - end - - context 'when total time spent is within the allowed range' do - before_all do - # Offset the time already spent - create(:issue_timelog, issue: issue, time_spent: -time_already_spent) - end - - it 'is valid' do - timelog = build(:issue_timelog, issue: issue, time_spent: 1.minute.to_i) - - expect(timelog).to be_valid - end - end - - context 'when total time spent is outside the allowed range' do - it 'adds an error if total time spent would exceed a year' do - time_to_spend = described_class::MAX_TOTAL_TIME_SPENT - time_already_spent + 1.second.to_i - timelog = build(:issue_timelog, issue: issue, time_spent: time_to_spend) - - expect { timelog.save! } - .to raise_error(ActiveRecord::RecordInvalid, - _('Validation failed: Total time spent cannot exceed a year.')) - end - - it 'adds an error if total time spent would be negative' do - time_to_spend = -time_already_spent - 1.second.to_i - timelog = build(:issue_timelog, issue: issue, time_spent: time_to_spend) - - expect { timelog.save! } - .to raise_error(ActiveRecord::RecordInvalid, - _('Validation failed: Total time spent cannot be negative.')) - end - end - end - describe 'when importing' do it 'is valid if issue_id and merge_request_id are missing' do subject.attributes = { issue: nil, merge_request: nil, importing: true } |