Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/raven/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def initialize(options = {}, &block)
@extra = options[:extra] || {}
@extra.merge!(context.extra)

@tags = @configuration.tags
@tags = {}
@tags.merge!(@configuration.tags)
@tags.merge!(options[:tags] || {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about solving this for all args? It doesn't seem correct for Event.initialize() to change its params at all. Eg @user, @extra, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ownership there is a bit more clear, but not opposed.

@tags.merge!(context.tags)

Expand Down
25 changes: 25 additions & 0 deletions spec/raven/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,31 @@
end
end

context 'configuration tags unspecified' do
it 'should not persist tags between unrelated events' do
config = Raven::Configuration.new

Raven::Event.new(
:level => 'warning',
:logger => 'foo',
:tags => {
'foo' => 'bar'
},
:server_name => 'foo.local',
:configuration => config
)

hash = Raven::Event.new(
:level => 'warning',
:logger => 'foo',
:server_name => 'foo.local',
:configuration => config
).to_hash

expect(hash['tags']).to eq({})
end
end

describe '.initialize' do
it 'should not touch the env object for an ignored environment' do
Raven.configure(true) do |config|
Expand Down