Skip to content

Commit

Permalink
Added spec for t.remove with multiple column names
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhayVAshokan committed Jan 31, 2025
1 parent 5277291 commit a64d024
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/rubocop/cop/neeto/unsafe_column_deletion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ def down
expect_no_offenses(snippet)
end

it "registers an offense when multiple columns are dropped in a single remove operation" do
snippet = <<~RUBY
change_table :users do |t|
t.remove :email, :first_name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{offense("users", "email", true)}
t.string :last_name, type: :string
end
RUBY

expect_offense(snippet)
end

private

def offense(table_name, column_name, change_table = false)
Expand Down

0 comments on commit a64d024

Please sign in to comment.