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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
f234d9f1
Commit
f234d9f1
authored
Mar 28, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly handle `ee` migration specs
parent
6fce4a49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
rubocop/cop/migration/update_column_in_batches.rb
rubocop/cop/migration/update_column_in_batches.rb
+1
-1
spec/rubocop/cop/migration/update_column_in_batches_spec.rb
spec/rubocop/cop/migration/update_column_in_batches_spec.rb
+18
-0
No files found.
rubocop/cop/migration/update_column_in_batches.rb
View file @
f234d9f1
...
...
@@ -28,7 +28,7 @@ module RuboCop
source_name
=
node
.
location
.
expression
.
source_buffer
.
name
path
=
Pathname
.
new
(
source_name
).
relative_path_from
(
rails_root
)
dirname
=
File
.
dirname
(
path
)
.
sub
(
%r{
\A
db/(migrate|post_migrate)}
,
'spec/migrations'
)
.
sub
(
%r{db/(migrate|post_migrate)}
,
'spec/migrations'
)
filename
=
File
.
basename
(
source_name
,
'.rb'
).
sub
(
/\A\d+_/
,
''
)
File
.
join
(
dirname
,
"
#{
filename
}
_spec.rb"
)
...
...
spec/rubocop/cop/migration/update_column_in_batches_spec.rb
View file @
f234d9f1
...
...
@@ -93,4 +93,22 @@ describe RuboCop::Cop::Migration::UpdateColumnInBatches do
it_behaves_like
'a migration file with no spec file'
it_behaves_like
'a migration file with a spec file'
end
context
'EE migrations'
do
let
(
:spec_filepath
)
{
tmp_rails_root
.
join
(
'ee'
,
'spec'
,
'migrations'
,
'my_super_migration_spec.rb'
)
}
context
'in a migration'
do
let
(
:migration_filepath
)
{
tmp_rails_root
.
join
(
'ee'
,
'db'
,
'migrate'
,
'20121220064453_my_super_migration.rb'
)
}
it_behaves_like
'a migration file with no spec file'
it_behaves_like
'a migration file with a spec file'
end
context
'in a post migration'
do
let
(
:migration_filepath
)
{
tmp_rails_root
.
join
(
'ee'
,
'db'
,
'post_migrate'
,
'20121220064453_my_super_migration.rb'
)
}
it_behaves_like
'a migration file with no spec file'
it_behaves_like
'a migration file with a spec file'
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