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

metric_image_spec.rb « alert_management « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dedbd6e501ed4895ca7004f7d82b857e996e8674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AlertManagement::MetricImage do
  subject { build(:alert_metric_image) }

  describe 'associations' do
    it { is_expected.to belong_to(:alert) }
  end

  describe 'validations' do
    it { is_expected.to be_valid }
    it { is_expected.to validate_presence_of(:file) }
    it { is_expected.to validate_length_of(:url).is_at_most(255) }
    it { is_expected.to validate_length_of(:url_text).is_at_most(128) }
  end

  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