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

mail_room_shared_examples.rb « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4cca29250e27f11eb89c43ef8efe1231183eab5c (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
34
35
# frozen_string_literal: true

shared_examples_for 'only truthy if both enabled and address are truthy' do |target_proc|
  context 'with both enabled and address as truthy values' do
    it 'is truthy' do
      stub_config(enabled: true, address: 'localhost')

      expect(target_proc.call).to be_truthy
    end
  end

  context 'with address only as truthy' do
    it 'is falsey' do
      stub_config(enabled: false, address: 'localhost')

      expect(target_proc.call).to be_falsey
    end
  end

  context 'with enabled only as truthy' do
    it 'is falsey' do
      stub_config(enabled: true, address: nil)

      expect(target_proc.call).to be_falsey
    end
  end

  context 'with neither address nor enabled as truthy' do
    it 'is falsey' do
      stub_config(enabled: false, address: nil)

      expect(target_proc.call).to be_falsey
    end
  end
end