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

user_allowlist_spec.rb « rack_attack « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aa604dfab7176961632b2673f74f1d3f669dc8eb (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
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::RackAttack::UserAllowlist do
  using RSpec::Parameterized::TableSyntax

  subject { described_class.new(input)}

  where(:input, :elements) do
    nil | []
    '' |  []
    '123' | [123]
    '123,456' | [123, 456]
    '123,foobar, 456,' | [123, 456]
  end

  with_them do
    it 'has the expected elements' do
      expect(subject).to contain_exactly(*elements)
    end

    it 'implements empty?' do
      expect(subject.empty?).to eq(elements.empty?)
    end

    it 'implements include?' do
      unless elements.empty?
        expect(subject).to include(elements.first)
      end
    end
  end
end