diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/rubocop/migration_helpers_spec.rb | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/rubocop/migration_helpers_spec.rb')
-rw-r--r-- | spec/rubocop/migration_helpers_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/rubocop/migration_helpers_spec.rb b/spec/rubocop/migration_helpers_spec.rb index 6e6c3a7a0b9..56b7b6aa76b 100644 --- a/spec/rubocop/migration_helpers_spec.rb +++ b/spec/rubocop/migration_helpers_spec.rb @@ -2,6 +2,7 @@ require 'fast_spec_helper' require 'rspec-parameterized' +require 'rubocop/ast' require_relative '../../rubocop/migration_helpers' @@ -69,4 +70,27 @@ RSpec.describe RuboCop::MigrationHelpers do it { expect(fake_cop.time_enforced?(node)).to eq(expected) } end end + + describe '#array_column?' do + let(:name) { nil } + let(:node) { double(:node, each_descendant: [pair_node]) } + let(:pair_node) { double(child_nodes: child_nodes) } + + context 'when it matches array: true' do + let(:child_nodes) do + [ + RuboCop::AST::SymbolNode.new(:sym, [:array]), + RuboCop::AST::Node.new(:true) # rubocop:disable Lint/BooleanSymbol + ] + end + + it { expect(fake_cop.array_column?(node)).to eq(true) } + end + + context 'when it matches a variable => 100' do + let(:child_nodes) { [RuboCop::AST::Node.new(:lvar, [:variable]), RuboCop::AST::IntNode.new(:int, [100])] } + + it { expect(fake_cop.array_column?(node)).to eq(false) } + end + end end |