test-prof 1.1.0 → 1.2.0
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 +4 -4
- data/CHANGELOG.md +9 -12
- data/lib/test_prof/any_fixture.rb +0 -13
- data/lib/test_prof/before_all/adapters/active_record.rb +19 -6
- data/lib/test_prof/recipes/rspec/let_it_be.rb +3 -1
- data/lib/test_prof/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 762cb1cd173cb06523693291ebd0abeff0608d027606f5a42eb49cb429f0ebb2
|
4
|
+
data.tar.gz: 704e418622ec41c6dc0df0323ff0de7eb6b072fa71649f54043fb2e38931d3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
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
|
|
data/lib/test_prof/version.rb
CHANGED
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.
|
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:
|
11
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|