Skip to content

Commit

Permalink
Add silence_warnings for defining 'not_' prefix enum elements
Browse files Browse the repository at this point in the history
To suppress the following warnings in tests.

```
~/rails/activerecord/lib/active_record/scoping/named.rb:190: warning: method redefined; discarding old not_sent
~/rails/activerecord/lib/active_record/scoping/named.rb:190: warning: previous definition of not_sent was here
```
  • Loading branch information
kamipo committed Jul 29, 2019
1 parent 6ebbe3f commit c6d751f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion activerecord/test/cases/enum_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,9 @@ def self.name; "Book"; end
def self.name
"Book"
end
enum status: [:sent, :not_sent]
silence_warnings do
enum status: [:sent, :not_sent]
end
end

assert_match(expected_message, logger.logged(:warn).first)
Expand Down

0 comments on commit c6d751f

Please sign in to comment.