rest-assured 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
|
|
1
|
+
# fix leaking db connections https://github.com/rails/rails/commit/ea341b8e043160a7ddaba9e6b2bb6044f73c31a8
|
2
|
+
# TODO remove with the next ActiveRecord update as this patch will be there
|
3
|
+
module ActiveRecord
|
4
|
+
class ConnectionAdapters::ConnectionPool
|
5
|
+
def current_connection_id #:nodoc:
|
6
|
+
ActiveRecord::Base.connection_id ||= Thread.current.object_id
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Base::ConnectionSpecification
|
11
|
+
class << self
|
12
|
+
def connection_id
|
13
|
+
Thread.current['ActiveRecord::Base.connection_id']
|
14
|
+
end
|
15
|
+
|
16
|
+
def connection_id=(connection_id)
|
17
|
+
Thread.current['ActiveRecord::Base.connection_id'] = connection_id
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class QueryCache
|
23
|
+
class BodyProxy
|
24
|
+
def initialize(original_cache_value, target, connection_id)
|
25
|
+
@original_cache_value = original_cache_value
|
26
|
+
@target = target
|
27
|
+
@connection_id = connection_id
|
28
|
+
end
|
29
|
+
|
30
|
+
def close
|
31
|
+
@target.close if @target.respond_to?(:close)
|
32
|
+
ensure
|
33
|
+
ActiveRecord::Base.connection_id = @connection_id
|
34
|
+
ActiveRecord::Base.connection.clear_query_cache
|
35
|
+
unless @original_cache_value
|
36
|
+
ActiveRecord::Base.connection.disable_query_cache!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def call(env)
|
42
|
+
old = ActiveRecord::Base.connection.query_cache_enabled
|
43
|
+
ActiveRecord::Base.connection.enable_query_cache!
|
44
|
+
|
45
|
+
status, headers, body = @app.call(env)
|
46
|
+
[status, headers, BodyProxy.new(old, body, ActiveRecord::Base.connection_id)]
|
47
|
+
rescue Exception => e
|
48
|
+
ActiveRecord::Base.connection.clear_query_cache
|
49
|
+
unless old
|
50
|
+
ActiveRecord::Base.connection.disable_query_cache!
|
51
|
+
end
|
52
|
+
raise e
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/rest-assured/init.rb
CHANGED
data/lib/rest-assured/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-assured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Artem Avetisyan
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- features/step_definitions/support/numeric_transforms.rb
|
152
152
|
- features/support/env.rb
|
153
153
|
- features/support/selenium-fix.rb
|
154
|
+
- lib/active_record/leak_connection_patch.rb
|
154
155
|
- lib/rest-assured.rb
|
155
156
|
- lib/rest-assured/config.rb
|
156
157
|
- lib/rest-assured/init.rb
|