Skip to content

Commit 26d508b

Browse files
committed
CR: add accepts case and add changelog entry
1 parent 104e5c9 commit 26d508b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
## master (unreleased)
44

5-
### Changes
6-
7-
* [#591](https://github.com/rubocop/rubocop-rails/issues/591): Add `change_column` to `Rails/ReversibleMigration`. ([@mattmccormick][])
8-
95
## 2.12.4 (2021-10-16)
106

117
### Bug fixes
@@ -488,4 +484,3 @@
488484
[@theunraveler]: https://github.com/theunraveler
489485
[@pirj]: https://github.com/pirj
490486
[@vitormd]: https://github.com/vitormd
491-
[@mattmccormick]: https://github.com/mattmccormick
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#591](https://github.com/rubocop/rubocop-rails/issues/591): Add `change_column` check to `Rails/ReversibleMigration`. ([@mattmccormick][])

lib/rubocop/cop/rails/reversible_migration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class ReversibleMigration < Base
179179
MSG = '%<action>s is not reversible.'
180180

181181
def_node_matcher :irreversible_schema_statement_call, <<~PATTERN
182-
(send nil? ${:execute :remove_belongs_to :change_column} ...)
182+
(send nil? ${:change_column :execute :remove_belongs_to} ...)
183183
PATTERN
184184

185185
def_node_matcher :drop_table_call, <<~PATTERN

spec/rubocop/cop/rails/reversible_migration_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def change
111111
end
112112

113113
context 'change_column' do
114+
it_behaves_like 'accepts', 'up_only', <<~RUBY
115+
up_only { change_column(:posts, :state, :string) }
116+
RUBY
117+
114118
it_behaves_like 'offense', 'change_column', <<~RUBY
115119
change_column(:posts, :state, :string)
116120
RUBY

0 commit comments

Comments
 (0)