diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-24 15:07:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-24 15:07:34 +0000 |
commit | df9890e9a702e2f12bbc8f022b916ca72820a292 (patch) | |
tree | 26ff255cfb6843fe963fcafea9ee70121ee5e913 /spec/rubocop | |
parent | 17c1c66eefd05243dd8ed2c8fd49d17ab1a52522 (diff) | |
download | gitlab-ce-df9890e9a702e2f12bbc8f022b916ca72820a292.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-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 |