Commit 24b5589c authored by Sean Arnold's avatar Sean Arnold

Fix some tests

parent b1044aeb
......@@ -27,6 +27,7 @@ module AlertManagement
has_many :notes, as: :noteable, inverse_of: :noteable, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_many :ordered_notes, -> { fresh }, as: :noteable, class_name: 'Note'
has_many :user_mentions, class_name: 'AlertManagement::AlertUserMention', foreign_key: :alert_management_alert_id
has_many :metric_images, class_name: '::AlertManagement::MetricImage'
has_internal_id :iid, scope: :project
......
......@@ -9,7 +9,6 @@ module EE
include AfterCommitQueue
has_many :pending_escalations, class_name: 'IncidentManagement::PendingEscalations::Alert', foreign_key: :alert_id, inverse_of: :alert
has_many :metric_images, class_name: '::AlertManagement::MetricImage'
after_create do |alert|
run_after_commit { alert.trigger_auto_rollback }
......
......@@ -12,6 +12,7 @@ module Gitlab
file
import_export
issuable_metric_image
metric_image
namespace_file
personal_file
].freeze
......
......@@ -19,6 +19,8 @@ RSpec.describe AlertManagement::MetricImage do
describe '.available_for?' do
subject { described_class.available_for?(issue.project) }
let_it_be_with_refind(:issue) { create(:issue) }
it { is_expected.to eq(true) }
end
end
......@@ -44,13 +44,6 @@ RSpec.describe AlertManagement::MetricImages::UploadService do
project.add_developer(current_user)
end
it_behaves_like 'no metric saved, an error given', 'You are not authorized to upload metric images'
context 'with license' do
before do
stub_licensed_features(alert_metric_upload: true)
end
it_behaves_like 'uploads the metric'
context 'no url given' do
......@@ -71,7 +64,7 @@ RSpec.describe AlertManagement::MetricImages::UploadService do
}
end
it_behaves_like 'no metric saved, an error given', /File does not have a supported extension. Only png, jpg, jpeg, gif, bmp, tiff, ico, and webp are supported/
it_behaves_like 'no metric saved, an error given', /File does not have a supported extension. Only png, jpg, jpeg, gif, bmp, tiff, ico, and webp are supported/ # rubocop: disable Layout/LineLength
end
context 'user is guest' do
......@@ -83,5 +76,4 @@ RSpec.describe AlertManagement::MetricImages::UploadService do
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment