Skip to content
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

Fix flaky session-tracking test #526

Merged
merged 3 commits into from
Jan 22, 2019
Merged
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
14 changes: 5 additions & 9 deletions spec/session_tracker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
require 'webrick'
require 'spec_helper'
require 'json'
require 'concurrent'

# Enable reset of session_counts between each example
module Bugsnag
class SessionTracker
attr_accessor :session_counts
end
end

describe Bugsnag::SessionTracker do
server = nil
Expand All @@ -27,7 +19,7 @@ class SessionTracker
Thread.new{ server.start }
end

after(:each) do
before(:each) do
Bugsnag.instance_variable_set(:@session_tracker, Bugsnag::SessionTracker.new)
end

Expand All @@ -40,6 +32,10 @@ class SessionTracker
queue.clear
end

after(:all) do
Bugsnag.instance_variable_set(:@session_tracker, Bugsnag::SessionTracker.new)
end

it 'adds session object to queue' do
tracker = Bugsnag::SessionTracker.new
tracker.start_session
Expand Down