test-prof 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e19d20bbf0af4e016f9dabfe56e8074cce79d750a359555a2855b982298aa8b
4
- data.tar.gz: 609607e479fabd363a6ee27e20b2f55845c9a5682fdec6352b5411b7c20e5ed5
3
+ metadata.gz: 762cb1cd173cb06523693291ebd0abeff0608d027606f5a42eb49cb429f0ebb2
4
+ data.tar.gz: 704e418622ec41c6dc0df0323ff0de7eb6b072fa71649f54043fb2e38931d3b2
5
5
  SHA512:
6
- metadata.gz: a17fe83206dd28c8b632acc3cfeb79c1acdf8344fbb199f1a688f1e61ef9f11097f0de0cc04ba1d153d108c2e966622062ea4e9917c2e8083c921de7b5bba9b6
7
- data.tar.gz: cdaf249b8072a916dad83d690d32d9264ff40c46c542f26374fd217324af99a04be61560753d37ee44a0298f05b71d1ef0616e62bf020035414c4ed28d51fab3
6
+ metadata.gz: cd989d5a679bacbd7aaa27faa9d828548de4d2b863c7e62566a6f8b3ac215b9e5fd205ab3dbf1a5cb5f755c7000151e75c7fe7d02735aff6a66b56e314da7925
7
+ data.tar.gz: 0e34dc7b6e413eec8a6b6f670458ec5801e9ed9233274effaa5b39920057816ea008a17dd17f3a1dbb641909bad8da1d5253b66e56a67b82a72608addf04646e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.2.0 (2023-02-07)
6
+
7
+ - Add support for multiple databases to `before_all` / `let_it_be` with Active Record. ([@rutgerw][])
8
+
5
9
  ## 1.1.0 (2022-12-06)
6
10
 
7
11
  - LetItBe: freeze records during initialization with `freeze: true`. ([@palkan][])
@@ -279,7 +283,7 @@ end
279
283
  - Add threshold and custom event support to FactoryDoctor. ([@palkan][])
280
284
 
281
285
  ```sh
282
- $ FDOC=1 FDOC_EVENT="sql.rom" FDOC_THRESHOLD=0.1 rspec
286
+ FDOC=1 FDOC_EVENT="sql.rom" FDOC_THRESHOLD=0.1 rspec
283
287
  ```
284
288
 
285
289
  - Add Fabrication support to FactoryDoctor. ([@palkan][])
@@ -328,16 +332,6 @@ end
328
332
  See [changelog](https://github.com/test-prof/test-prof/blob/v0.8.0/CHANGELOG.md) for versions <0.9.0.
329
333
 
330
334
  [@palkan]: https://github.com/palkan
331
- [@marshall-lee]: https://github.com/marshall-lee
332
- [@danielwestendorf]: https://github.com/danielwestendorf
333
- [@shkrt]: https://github.com/Shkrt
334
- [@idolgirev]: https://github.com/IDolgirev
335
- [@desoleary]: https://github.com/desoleary
336
- [@rabotyaga]: https://github.com/rabotyaga
337
- [@vasfed]: https://github.com/Vasfed
338
- [@szemek]: https://github.com/szemek
339
- [@mkldon]: https://github.com/mkldon
340
- [@dmagro]: https://github.com/dmagro
341
335
  [@danielwaterworth]: https://github.com/danielwaterworth
342
336
  [@envek]: https://github.com/Envek
343
337
  [@tyleriguchi]: https://github.com/tyleriguchi
@@ -347,9 +341,12 @@ See [changelog](https://github.com/test-prof/test-prof/blob/v0.8.0/CHANGELOG.md)
347
341
  [@stefkin]: https://github.com/stefkin
348
342
  [@jaimerson]: https://github.com/jaimerson
349
343
  [@alexvko]: https://github.com/alexvko
350
- [@grillermo]: https://github.com/grillermo
351
344
  [@cou929]: https://github.com/cou929
352
345
  [@ruslanshakirov]: https://github.com/ruslanshakirov
353
346
  [@ygelfand]: https://github.com/ygelfand
354
347
  [@cbliard]: https://github.com/cbliard
355
348
  [@maxshend]: https://github.com/maxshend
349
+ [@rutgerw]: https://github.com/rutgerw
350
+ [@markedmondson]: https://github.com/markedmondson
351
+ [@cbarton]: https://github.com/cbarton
352
+ [@peret]: https://github.com/peret
@@ -102,19 +102,6 @@ module TestProf
102
102
  yield config
103
103
  end
104
104
 
105
- # Backward compatibility
106
- def reporting_enabled=(val)
107
- warn "AnyFixture.reporting_enabled is deprecated and will be removed in 1.1. Use AnyFixture.config.reporting_enabled instead"
108
- config.reporting_enabled = val
109
- end
110
-
111
- def reporting_enabled
112
- warn "AnyFixture.reporting_enabled is deprecated and will be removed in 1.1. Use AnyFixture.config.reporting_enabled instead"
113
- config.reporting_enabled
114
- end
115
-
116
- alias_method :reporting_enabled?, :reporting_enabled
117
-
118
105
  # Register a block of code as a fixture,
119
106
  # returns the result of the block execution
120
107
  def register(id)
@@ -6,17 +6,30 @@ module TestProf
6
6
  # ActiveRecord adapter for `before_all`
7
7
  module ActiveRecord
8
8
  class << self
9
+ def all_connections
10
+ @all_connections ||= if ::ActiveRecord::Base.respond_to? :connects_to
11
+ ::ActiveRecord::Base.connection_handler.connection_pool_list.map(&:connection)
12
+ else
13
+ Array.wrap(::ActiveRecord::Base.connection)
14
+ end
15
+ end
16
+
9
17
  def begin_transaction
10
- ::ActiveRecord::Base.connection.begin_transaction(joinable: false)
18
+ @all_connections = nil
19
+ all_connections.each do |connection|
20
+ connection.begin_transaction(joinable: false)
21
+ end
11
22
  end
12
23
 
13
24
  def rollback_transaction
14
- if ::ActiveRecord::Base.connection.open_transactions.zero?
15
- warn "!!! before_all transaction has been already rollbacked and " \
16
- "could work incorrectly"
17
- return
25
+ all_connections.each do |connection|
26
+ if connection.open_transactions.zero?
27
+ warn "!!! before_all transaction has been already rollbacked and " \
28
+ "could work incorrectly"
29
+ next
30
+ end
31
+ connection.rollback_transaction
18
32
  end
19
- ::ActiveRecord::Base.connection.rollback_transaction
20
33
  end
21
34
 
22
35
  def setup_fixtures(test_object)
@@ -82,10 +82,12 @@ module TestProf
82
82
  "Available modifiers are: #{modifiers.keys.join(", ")}"
83
83
  end
84
84
  end
85
+
85
86
  # Use uniq prefix for instance variables to avoid collisions
86
87
  # We want to use the power of Ruby's unicode support)
87
88
  # And we love cats!)
88
- PREFIX = "@😸"
89
+ # Allow overriding the prefix (there are some intermittent issues on JRuby still)
90
+ PREFIX = ENV.fetch("LET_IT_BE_IVAR_PREFIX", "@😸")
89
91
 
90
92
  FROZEN_ERROR_HINT = "\nIf you are using `let_it_be`, you may want to pass `reload: true` or `refind: true` modifier to it."
91
93
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestProf
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
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: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-06 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler