it'registers an offense when adding a column to a wide table'do
it'registers an offense when adding a column to a wide table'do
offense='`projects` is a wide table with several columns, addig more should be avoided unless absolutely necessary. Consider storing the column in a different table or creating a new one.'
offense='`projects` is a wide table with several columns, [...]'
expect_offense(<<~RUBY)
expect_offense(<<~RUBY)
def up
def up
...
@@ -37,7 +35,7 @@ RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
...
@@ -37,7 +35,7 @@ RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
end
end
it'registers an offense when adding a column with default to a wide table'do
it'registers an offense when adding a column with default to a wide table'do
offense='`users` is a wide table with several columns, addig more should be avoided unless absolutely necessary. Consider storing the column in a different table or creating a new one.'
offense='`users` is a wide table with several columns, [...]'
expect_offense(<<~RUBY)
expect_offense(<<~RUBY)
def up
def up
...
@@ -48,7 +46,7 @@ RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
...
@@ -48,7 +46,7 @@ RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
end
end
it'registers an offense when adding a reference'do
it'registers an offense when adding a reference'do
offense='`ci_builds` is a wide table with several columns, addig more should be avoided unless absolutely necessary. Consider storing the column in a different table or creating a new one.'
offense='`ci_builds` is a wide table with several columns, [...]'
expect_offense(<<~RUBY)
expect_offense(<<~RUBY)
def up
def up
...
@@ -59,7 +57,7 @@ RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
...
@@ -59,7 +57,7 @@ RSpec.describe RuboCop::Cop::Migration::AddColumnsToWideTables do
end
end
it'registers an offense when adding timestamps'do
it'registers an offense when adding timestamps'do
offense='`projects` is a wide table with several columns, addig more should be avoided unless absolutely necessary. Consider storing the column in a different table or creating a new one.'
offense='`projects` is a wide table with several columns, [...]'
let(:offense){'`add_reference` requires downtime for existing tables, use `add_concurrent_foreign_key` instead. When used for new tables, `index: true` or `index: { options... } is required.`'}
let(:offense){'`add_reference` requires downtime for existing tables, use `add_concurrent_foreign_key`[...]'}
context'when the table existed before'do
context'when the table existed before'do
it'registers an offense when using add_reference'do
it'registers an offense when using add_reference'do