Skip to content

Commit 221a914

Browse files
committed
Introduced #attributes_for_inspect in Rails 7.2
By default, only `id` is output, so set `:all` to output all attributes for testing. related: rails/rails#49765
1 parent dcd541a commit 221a914

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

spec/activerecord-multi-tenant/model_extensions_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ def self.name
132132
end
133133

134134
describe 'inspect method filters senstive column values' do
135+
if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 2
136+
# related: https://github.com/rails/rails/pull/49765
137+
around do |example|
138+
prev = Account.attributes_for_inspect
139+
Account.attributes_for_inspect = :all
140+
example.run
141+
ensure
142+
Account.attributes_for_inspect = prev
143+
end
144+
end
145+
135146
it 'filters senstive value' do
136147
account = Account.new(name: 'foo', password: 'baz')
137148
expect(account.inspect).to eq '#<Account id: nil, name: nil, subdomain: nil, domain: nil, password: [FILTERED]>'

0 commit comments

Comments
 (0)