summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/performance_bar/with_top_level_warnings_spec.rb
blob: 3b92261f0fe5724f3c6cf5032277f86bce51f0aa (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
27
28
29
# frozen_string_literal: true

require 'fast_spec_helper'
require 'rspec-parameterized'

describe Gitlab::PerformanceBar::WithTopLevelWarnings do
  using RSpec::Parameterized::TableSyntax

  subject { Module.new }

  before do
    subject.singleton_class.prepend(described_class)
  end

  describe '#has_warnings?' do
    where(:has_warnings, :results) do
      false | { data: {} }
      false | { data: { gitaly: { warnings: [] } } }
      true  | { data: { gitaly: { warnings: [1] } } }
      true  | { data: { gitaly: { warnings: [] }, redis: { warnings: [1] } } }
    end

    with_them do
      it do
        expect(subject.has_warnings?(results)).to eq(has_warnings)
      end
    end
  end
end