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

audit_event_save_type_spec.rb « concerns « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fbaebd9f85c1addaf4a1fb50b976ca6256262fa6 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AuditEventSaveType do
  subject(:target) { Object.new.extend(described_class) }

  describe '#should_save_database? and #should_save_stream?' do
    using RSpec::Parameterized::TableSyntax

    where(:query_method, :query_param, :result) do
      :should_save_stream?    | :stream               | true
      :should_save_stream?    | :database_and_stream  | true
      :should_save_database?  | :database             | true
      :should_save_database?  | :database_and_stream  | true
      :should_save_stream?    | :database             | false
      :should_save_stream?    | nil                   | false
      :should_save_database?  | :stream               | false
      :should_save_database?  | nil                   | false
    end

    with_them do
      it 'returns corresponding results according to the query_method and query_param' do
        expect(target.send(query_method, query_param)).to eq result
      end
    end
  end
end