test-prof 0.7.0 → 0.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8baffb743630e819928190645aa63d73436f2dc54fc2c56ab1ad5df8141ed3c
4
- data.tar.gz: 7738b154073f150e23df40193f350e93e2fb047758023021acef237e08988da3
3
+ metadata.gz: b7a28cb7092435d6e8d053a9c50e698f3665dfec31a300b51d40ac04c615978d
4
+ data.tar.gz: 1707c8668e817ba5ea961a2c415e6a253e390d103973d0108215f4cf4b5af725
5
5
  SHA512:
6
- metadata.gz: f2f75e27df1795a31f3e39312bfa6268502881f1fd6cb28376603f0486048376d12d5e0266edb2eb7e76f6a54723ae03c43a6c35167242fe2c361b12535cda93
7
- data.tar.gz: 56b472304e1291e9f392a2c62c36bc40fc2ad575c0b976d46a8f2fd881bfbf2db3f0948014dd29b99cf63eccded2a63b0ddd834676221f354e872622a80dc883
6
+ metadata.gz: b32c1c84e619f109120b6c83e10d050861618179cc55d11d5cf33ad2760275d934a7280247781b44970b0433ef8eed55afbbd3bc724b0e13f9afd0470a1a0008
7
+ data.tar.gz: 71639f7f96fc5274c0a9eefa76da473c00d9819260987ad315273a301e3331c72b7113b3d3a7b3246a7bef3bd5ff0177147a17846afc2eae6f5f847a0842df73
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.7.1 (2018-08-20)
6
+
7
+ - Add ability to ignore connection configurations in shared connection.([@palkan][])
8
+
9
+ Example:
10
+
11
+ ```ruby
12
+ # Do not use shared connection for sqlite db
13
+ TestProf::ActiveRecordSharedConnection.ignore { |config| config[:adapter] == "sqlite3" }
14
+ ```
15
+
5
16
  ## 0.7.0 (2018-08-12)
6
17
 
7
18
  - **Ruby 2.3+ is required**. ([@palkan][])
@@ -14,8 +14,22 @@ module TestProf
14
14
  self.connection = nil
15
15
  end
16
16
 
17
+ def ignore
18
+ raise ArgumentError, "Block is required" unless block_given?
19
+
20
+ @ignores ||= []
21
+
22
+ ignores << Proc.new
23
+ end
24
+
25
+ def ignored?(config)
26
+ !ignores.nil? && ignores.any? { |clbk| clbk.call(config) }
27
+ end
28
+
17
29
  private
18
30
 
31
+ attr_reader :ignores
32
+
19
33
  def connection=(conn)
20
34
  @connection = conn
21
35
  connection.singleton_class.prepend Connection
@@ -43,6 +57,7 @@ module TestProf
43
57
 
44
58
  module Ext
45
59
  def connection
60
+ return super if ActiveRecordSharedConnection.ignored?(connection_config)
46
61
  ActiveRecordSharedConnection.connection || super
47
62
  end
48
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestProf
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-13 00:00:00.000000000 Z
11
+ date: 2018-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler