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

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

require 'spec_helper'

RSpec.describe Pages::PageDeletedEvent do
  where(:data, :valid) do
    [
      [{ project_id: 1, namespace_id: 2 }, true],
      [{ project_id: 1 }, false],
      [{ namespace_id: 1 }, false],
      [{ project_id: 'foo', namespace_id: 2 }, false],
      [{ project_id: 1, namespace_id: 'foo' }, false],
      [{ project_id: [], namespace_id: 2 }, false],
      [{ project_id: 1, namespace_id: [] }, false],
      [{ project_id: {}, namespace_id: 2 }, false],
      [{ project_id: 1, namespace_id: {} }, false],
      ['foo', false],
      [123, false],
      [[], false]
    ]
  end

  with_them do
    it 'validates data' do
      constructor = -> { described_class.new(data: data) }

      if valid
        expect { constructor.call }.not_to raise_error
      else
        expect { constructor.call }.to raise_error(Gitlab::EventStore::InvalidEvent)
      end
    end
  end
end