-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Reset CurrentAttributes on each rails example #2752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
0e72a05
d829a02
9089639
91167a0
9e35e00
808fef7
b27a5b9
d1a4c0d
3013459
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
module RSpec::Rails | ||
RSpec.describe RailsExampleGroup do | ||
if ::Rails::VERSION::MAJOR >= 7 | ||
class CurrentSample < ActiveSupport::CurrentAttributes | ||
attribute :request_id | ||
end | ||
|
||
it 'supports tagged_logger' do | ||
expect(described_class.private_instance_methods).to include(:tagged_logger) | ||
end | ||
|
@@ -32,5 +36,18 @@ module RSpec::Rails | |
|
||
expect(results).to all be true | ||
end | ||
|
||
describe 'CurrentAttributes', order: :defined, if: ::Rails::VERSION::MAJOR >= 7 do | ||
|
||
include RSpec::Rails::RailsExampleGroup | ||
|
||
it 'sets a current attribute' do | ||
CurrentSample.request_id = '123' | ||
expect(CurrentSample.request_id).to eq('123') | ||
end | ||
|
||
it 'does not leak current attributes' do | ||
expect(CurrentSample.request_id).to eq(nil) | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What fails exactly without this?
At a glance it may looks that it’s the following example that check for tagged logger, but I guess it’s not, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its just setup...