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
a643dbda
Commit
a643dbda
authored
Sep 12, 2020
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add regression test for create table with 2 foreign keys cop
parent
a6dde030
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb
...ocop/cop/migration/create_table_with_foreign_keys_spec.rb
+21
-7
No files found.
spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb
View file @
a643dbda
...
...
@@ -42,14 +42,28 @@ RSpec.describe RuboCop::Cop::Migration::CreateTableWithForeignKeys, type: :ruboc
context
'with foreign key'
do
context
'with just one foreign key'
do
context
'when the foreign_key targets a high traffic table'
do
it
'does not register any offenses'
do
expect_no_offenses
(
<<~
RUBY
)
def up
create_table(:foo) do |t|
t.references :project, "foreign_key" => { on_delete: 'cascade', to_table: 'projects' }
context
'when the foreign_key has to_table option set'
do
it
'does not register any offenses'
do
expect_no_offenses
(
<<~
RUBY
)
def up
create_table(:foo) do |t|
t.references :project, "foreign_key" => { on_delete: 'cascade', to_table: 'projects' }
end
end
end
RUBY
RUBY
end
end
context
'when the foreign_key does not have to_table option set'
do
it
'does not register any offenses'
do
expect_no_offenses
(
<<~
RUBY
)
def up
create_table(:foo) do |t|
t.references :project, foreign_key: { on_delete: 'cascade' }
end
end
RUBY
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