Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Duplicate the global config object before sending to instantiated ses…

…sion to prevent threading bugs
  • Loading branch information...
commit 437c8ae463cef7d4ac8bec4ba44b045cdc357ace 1 parent 5a1671b
@kyledrake kyledrake authored
View
2  lib/geoloqi/session.rb
@@ -36,7 +36,7 @@ class Session
# geoloqi_session = Geoloqi::Session.new :config => {:client_id => 'CLIENT ID', :client_secret => 'CLIENT SECRET'}
def initialize(opts={})
opts[:config] = Geoloqi::Config.new opts[:config] if opts[:config].is_a? Hash
- @config = opts[:config] || (Geoloqi.config || Geoloqi::Config.new)
+ @config = opts[:config] || (Geoloqi.config || Geoloqi::Config.new).dup
self.auth = opts[:auth] || {}
self.auth[:access_token] = opts[:access_token] if opts[:access_token]
View
2  lib/geoloqi/version.rb
@@ -3,6 +3,6 @@ module Geoloqi
#
# @return [String]
def self.version
- '0.9.38'
+ '0.9.39'
end
end
View
4 spec/geoloqi/session_spec.rb
@@ -6,6 +6,10 @@
@session = Geoloqi::Session.new
end
+ it 'should have unique copy of config object' do
+ @session.config.__id__.wont_equal Geoloqi.config.__id__
+ end
+
it 'should not find access token' do
@session.access_token?.must_equal false
end
Please sign in to comment.
Something went wrong with that request. Please try again.