summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/gitlab/union_spec.rb
blob: f0544fdb66ef3429afb802e1baae6c26d9971a63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/union'

describe RuboCop::Cop::Gitlab::Union do
  include CopHelper

  subject(:cop) { described_class.new }

  it 'flags the use of Gitlab::SQL::Union.new' do
    expect_offense(<<~SOURCE)
    Gitlab::SQL::Union.new([foo])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the `FromUnion` concern, instead of using `Gitlab::SQL::Union` directly
    SOURCE
  end
end