Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1b245725
Commit
1b245725
authored
Nov 20, 2019
by
Eric Thomas
Committed by
Rémy Coutable
Nov 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing add index rubocop spec
parent
9a6ab07c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
changelogs/unreleased/add_missing_add_index_rubocop_spec.yml
changelogs/unreleased/add_missing_add_index_rubocop_spec.yml
+5
-0
spec/rubocop/cop/migration/add_index_spec.rb
spec/rubocop/cop/migration/add_index_spec.rb
+39
-0
No files found.
changelogs/unreleased/add_missing_add_index_rubocop_spec.yml
0 → 100644
View file @
1b245725
---
title
:
add missing test for add_index rubocop rule
merge_request
:
20464
author
:
Eric Thomas
type
:
other
spec/rubocop/cop/migration/add_index_spec.rb
0 → 100644
View file @
1b245725
# frozen_string_literal: true
require
'spec_helper'
require
'rubocop'
require
'rubocop/rspec/support'
require_relative
'../../../../rubocop/cop/migration/add_index'
describe
RuboCop
::
Cop
::
Migration
::
AddIndex
do
include
CopHelper
subject
(
:cop
)
{
described_class
.
new
}
context
'in migration'
do
before
do
allow
(
cop
).
to
receive
(
:in_migration?
).
and_return
(
true
)
end
it
'registers an offense when add_index is used'
do
expect_offense
(
<<~
PATTERN
.
strip_indent
)
def change
add_index :table, :column
^^^^^^^^^ `add_index` requires downtime, use `add_concurrent_index` instead
end
PATTERN
end
end
context
'outside of migration'
do
it
'registers no offense'
do
expect_no_offenses
(
<<~
PATTERN
.
strip_indent
)
def change
add_index :table, :column
end
PATTERN
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment