rspec-stubbed_env 1.0.16 → 1.0.18
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +48 -1
- data/README.md +16 -39
- data/lib/rspec/stubbed_env/hide_helpers.rb +0 -23
- data/lib/rspec/stubbed_env/stub_helpers.rb +44 -33
- data/lib/rspec/stubbed_env/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +21 -21
- metadata.gz.sig +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27fd2832ac691ef8d48cf88938d5417c9d08634b440a490e4e7710f13b552607
|
|
4
|
+
data.tar.gz: 7ca279d21512a43fbc458ebfbc24ecc928b51702ccdc8ca63cdf32bcedfe72a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be23093d9e215e92159f96958eee65548b66eba15248e4a6a9e1d676d355ee9952c942e97f0cf0608d57ab19325913e2c40d0c6f3dee4c9c9cfba6098ac76422
|
|
7
|
+
data.tar.gz: 5447d00a18b37c7cabaf94be84eddc40f3454eacdb671bba40b2d034a8c47f89d78edd9152c2bd48b62cfff69b6fcc276311b8c26c0014a5611e403d6f64ed2b
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,49 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [1.0.18] - 2026-11-09
|
|
34
|
+
|
|
35
|
+
- TAG: [v1.0.18][1.0.18t]
|
|
36
|
+
- COVERAGE: 100.00% -- 84/84 lines in 5 files
|
|
37
|
+
- BRANCH COVERAGE: 100.00% -- 31/31 branches in 5 files
|
|
38
|
+
- 75.00% documented
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- [kc] kettle-jem/prepare: updated 27 project files:
|
|
43
|
+
- configuration (1)
|
|
44
|
+
- dependencies (26)
|
|
45
|
+
|
|
46
|
+
- [kc] kettle-jem/template: updated 53 project files:
|
|
47
|
+
- code and tests (2)
|
|
48
|
+
- dependencies (18)
|
|
49
|
+
- documentation (1)
|
|
50
|
+
- other (4)
|
|
51
|
+
- workflows (28)
|
|
52
|
+
|
|
53
|
+
## [1.0.17] - 2026-10-13
|
|
54
|
+
|
|
55
|
+
- TAG: [v1.0.17][1.0.17t]
|
|
56
|
+
- COVERAGE: 100.00% -- 84/84 lines in 5 files
|
|
57
|
+
- BRANCH COVERAGE: 100.00% -- 31/31 branches in 5 files
|
|
58
|
+
- 75.00% documented
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- [kc] kettle-jem/prepare: updated 37 project files:
|
|
63
|
+
- configuration (1)
|
|
64
|
+
- dependencies (36)
|
|
65
|
+
- [kc] kettle-jem/template: updated 21 project files:
|
|
66
|
+
- code and tests (4)
|
|
67
|
+
- dependencies (2)
|
|
68
|
+
- documentation (2)
|
|
69
|
+
- other (2)
|
|
70
|
+
- workflows (11)
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
|
|
74
|
+
- Re-stubbing the same ENV key across examples no longer raises "message expectation ... has already been invoked and cannot be modified further": ENV accessors are stubbed with one block-backed receive per accessor reading a mutation ledger, instead of per-key .with(key) expectations that collide after invocation (observed as a seed-dependent failure on kettle-dev's jruby-9.2 CI lane)
|
|
75
|
+
|
|
33
76
|
## [1.0.16] - 2026-10-01
|
|
34
77
|
|
|
35
78
|
- TAG: [v1.0.16][1.0.16t]
|
|
@@ -390,7 +433,11 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
390
433
|
[@darhazer]: https://github.com/darhazer
|
|
391
434
|
[@hosamaly]: https://github.com/hosamaly
|
|
392
435
|
|
|
393
|
-
[Unreleased]: https://github.com/galtzo-floss/rspec-stubbed_env/compare/v1.0.
|
|
436
|
+
[Unreleased]: https://github.com/galtzo-floss/rspec-stubbed_env/compare/v1.0.18...HEAD
|
|
437
|
+
[1.0.18]: https://github.com/galtzo-floss/rspec-stubbed_env/compare/v1.0.17...v1.0.18
|
|
438
|
+
[1.0.18t]: https://github.com/galtzo-floss/rspec-stubbed_env/releases/tag/v1.0.18
|
|
439
|
+
[1.0.17]: https://github.com/galtzo-floss/rspec-stubbed_env/compare/v1.0.16...v1.0.17
|
|
440
|
+
[1.0.17t]: https://github.com/galtzo-floss/rspec-stubbed_env/releases/tag/v1.0.17
|
|
394
441
|
[1.0.16]: https://github.com/galtzo-floss/rspec-stubbed_env/compare/v1.0.15...v1.0.16
|
|
395
442
|
[1.0.16t]: https://github.com/galtzo-floss/rspec-stubbed_env/releases/tag/v1.0.16
|
|
396
443
|
[1.0.15]: https://github.com/galtzo-floss/rspec-stubbed_env/compare/v1.0.14...v1.0.15
|
data/README.md
CHANGED
|
@@ -71,7 +71,7 @@ due to the inherent limitations of GitHub Actions.
|
|
|
71
71
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
72
72
|
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
73
73
|
| Works with JRuby | [![JRuby 9.2 Compat][💎jruby-9.2i]][🚎jruby-9.2-wf] [![JRuby 9.3 Compat][💎jruby-9.3i]][🚎jruby-9.3-wf] <br/> [![JRuby 9.4 Compat][💎jruby-9.4i]][🚎jruby-9.4-wf] [![JRuby 10.0 Compat][💎jruby-10.0i]][🚎jruby-10.0-wf] [![JRuby current Compat][💎jruby-c-i]][🚎10-j-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf]|
|
|
74
|
-
| Works with Truffle Ruby | [![Truffle Ruby 22.3 Compat][💎truby-22.3i]][🚎truby-22.3-wf] [![Truffle Ruby 23.
|
|
74
|
+
| Works with Truffle Ruby | [![Truffle Ruby 22.3 Compat][💎truby-22.3i]][🚎truby-22.3-wf] [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎truby-23.1-wf] <br/> [![Truffle Ruby 24.2 Compat][💎truby-24.2i]][🚎truby-24.2-wf] [![Truffle Ruby 25.0 Compat][💎truby-25.0i]][🚎truby-25.0-wf] [![Truffle Ruby 33.0 Compat][💎truby-33.0i]][🚎truby-33.0-wf] [![Truffle Ruby current Compat][💎truby-c-i]][🚎9-t-wf]|
|
|
75
75
|
| Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf]|
|
|
76
76
|
| Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎ruby-3.0-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎ruby-3.1-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎ruby-3.2-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎ruby-3.3-wf] [![Ruby 3.4 Compat][💎ruby-3.4i]][🚎ruby-3.4-wf]|
|
|
77
77
|
| Works with MRI Ruby 2 | ![Ruby 2.0 Compat][💎ruby-2.0i] ![Ruby 2.1 Compat][💎ruby-2.1i] ![Ruby 2.2 Compat][💎ruby-2.2i] ![Ruby 2.3 Compat][💎ruby-2.3i] <br/> [![Ruby 2.4 Compat][💎ruby-2.4i]][🚎ruby-2.4-wf] [![Ruby 2.5 Compat][💎ruby-2.5i]][🚎ruby-2.5-wf] [![Ruby 2.6 Compat][💎ruby-2.6i]][🚎ruby-2.6-wf] [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎ruby-2.7-wf]|
|
|
@@ -86,11 +86,12 @@ due to the inherent limitations of GitHub Actions.
|
|
|
86
86
|
|
|
87
87
|
### Compatibility
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
The gem's declared runtime compatibility floor is MRI Ruby 1.8.7+, with concordant releases of JRuby and TruffleRuby.
|
|
90
90
|
CI workflows and Appraisals are generated for MRI Ruby 2.4+.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
The current MRI CI lane runs on Linux and macOS.
|
|
92
|
+
The test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml`.
|
|
93
|
+
When it is higher than the runtime floor, older runtime-compatible Rubies are
|
|
94
|
+
not covered by the generated CI or Appraisal matrix.
|
|
94
95
|
|
|
95
96
|
<a href="https://github.com/kettle-dev"><img alt="kettle-dev Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/kettle-dev/avatar-128px.svg" width="14%" align="right"/></a>
|
|
96
97
|
|
|
@@ -127,29 +128,12 @@ The _amazing_ test matrix is powered by the kettle-dev stack.
|
|
|
127
128
|
|
|
128
129
|
### Enterprise Support
|
|
129
130
|
|
|
130
|
-
[
|
|
131
|
+
For enterprise support from the maintainer, use [Upwork][👨🏼🏫expsup-upwork] or [CodeMentor][👨🏼🏫expsup-codementor].
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<details markdown="1">
|
|
135
|
-
<summary>Need enterprise-level guarantees?</summary>
|
|
136
|
-
|
|
137
|
-
The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
|
|
138
|
-
|
|
139
|
-
[![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
|
|
140
|
-
|
|
141
|
-
- 💡Subscribe for support guarantees covering _all_ your FLOSS dependencies
|
|
142
|
-
- 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]
|
|
143
|
-
- 💡Tidelift pays maintainers to maintain the software you depend on!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers
|
|
144
|
-
|
|
145
|
-
Alternatively:
|
|
133
|
+
Other support channels:
|
|
146
134
|
|
|
147
135
|
- [![Ruby Users Forum][✉️ruby-forum-img]][✉️ruby-forum]
|
|
148
136
|
- [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
|
|
149
|
-
- [![Get help from me on Upwork][👨🏼🏫expsup-upwork-img]][👨🏼🏫expsup-upwork]
|
|
150
|
-
- [![Get help from me on Codementor][👨🏼🏫expsup-codementor-img]][👨🏼🏫expsup-codementor]
|
|
151
|
-
|
|
152
|
-
</details>
|
|
153
137
|
|
|
154
138
|
## ✨ Installation
|
|
155
139
|
|
|
@@ -340,19 +324,18 @@ We welcome both individual and corporate sponsors! We also offer a
|
|
|
340
324
|
wide array of funding channels to account for your preferences.
|
|
341
325
|
Currently, [Open Collective][🖇osc] is our preferred funding platform.
|
|
342
326
|
|
|
327
|
+
### Corporate Sponsorship
|
|
328
|
+
|
|
343
329
|
**If you're working in a company that's making significant use of galtzo-floss tools we'd
|
|
344
330
|
appreciate it if you suggest to your company to become a galtzo-floss sponsor.**
|
|
345
331
|
|
|
332
|
+
### Individual Support
|
|
333
|
+
|
|
346
334
|
You can support the development of galtzo-floss tools via
|
|
347
335
|
[GitHub Sponsors][🖇sponsor],
|
|
348
336
|
[Liberapay][⛳liberapay],
|
|
349
|
-
[
|
|
350
|
-
[
|
|
351
|
-
and [Tidelift][🏙️entsup-tidelift].
|
|
352
|
-
|
|
353
|
-
| 📍 NOTE |
|
|
354
|
-
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
355
|
-
| If doing a sponsorship in the form of donation is problematic for your company <br/> from an accounting standpoint, we'd recommend the use of Tidelift, <br/> where you can get a support-like subscription instead. |
|
|
337
|
+
[Open Collective][🖇osc],
|
|
338
|
+
and [PayPal][🖇paypal].
|
|
356
339
|
|
|
357
340
|
### Open Collective for Individuals
|
|
358
341
|
|
|
@@ -568,9 +551,6 @@ Thanks for RTFM. ☺️
|
|
|
568
551
|
[👨🏼🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
|
|
569
552
|
[👨🏼🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
|
|
570
553
|
[👨🏼🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
|
|
571
|
-
[🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-rspec-stubbed_env?utm_source=rubygems-rspec-stubbed_env&utm_medium=referral&utm_campaign=readme
|
|
572
|
-
[🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
|
|
573
|
-
[🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
|
|
574
554
|
[💁🏼♂️peterboling]: http://www.peterboling.com
|
|
575
555
|
[🚂railsbling]: http://www.railsbling.com
|
|
576
556
|
[📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
|
|
@@ -611,7 +591,6 @@ Thanks for RTFM. ☺️
|
|
|
611
591
|
[🚎jruby-9.4-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/jruby-9.4.yml
|
|
612
592
|
[🚎jruby-10.0-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/jruby-10.0.yml
|
|
613
593
|
[🚎truby-22.3-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/truffleruby-22.3.yml
|
|
614
|
-
[🚎truby-23.0-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/truffleruby-23.0.yml
|
|
615
594
|
[🚎truby-23.1-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/truffleruby-23.1.yml
|
|
616
595
|
[🚎truby-24.2-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/truffleruby-24.2.yml
|
|
617
596
|
[🚎truby-25.0-wf]: https://github.com/galtzo-floss/rspec-stubbed_env/actions/workflows/truffleruby-25.0.yml
|
|
@@ -654,13 +633,11 @@ Thanks for RTFM. ☺️
|
|
|
654
633
|
[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
|
|
655
634
|
[💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
|
|
656
635
|
[💎truby-22.3i]: https://img.shields.io/badge/Truffle_Ruby-22.3-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
657
|
-
[💎truby-23.0i]: https://img.shields.io/badge/Truffle_Ruby-23.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
658
636
|
[💎truby-23.1i]: https://img.shields.io/badge/Truffle_Ruby-23.1-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
659
637
|
[💎truby-24.2i]: https://img.shields.io/badge/Truffle_Ruby-24.2-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
660
638
|
[💎truby-25.0i]: https://img.shields.io/badge/Truffle_Ruby-25.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
661
639
|
[💎truby-33.0i]: https://img.shields.io/badge/Truffle_Ruby-33.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
662
640
|
[💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge&logo=ruby&logoColor=green
|
|
663
|
-
[💎truby-headi]: https://img.shields.io/badge/Truffle_Ruby-HEAD-34BCB1?style=for-the-badge&logo=ruby&logoColor=blue
|
|
664
641
|
[💎jruby-9.2i]: https://img.shields.io/badge/JRuby-9.2-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
665
642
|
[💎jruby-9.3i]: https://img.shields.io/badge/JRuby-9.3-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
666
643
|
[💎jruby-9.4i]: https://img.shields.io/badge/JRuby-9.4-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
@@ -693,7 +670,7 @@ Thanks for RTFM. ☺️
|
|
|
693
670
|
[📌gitmoji]: https://gitmoji.dev
|
|
694
671
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
695
672
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
696
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.
|
|
673
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.084-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
697
674
|
[🔐security]: https://github.com/galtzo-floss/rspec-stubbed_env/blob/main/SECURITY.md
|
|
698
675
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
699
676
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -723,5 +700,5 @@ Thanks for RTFM. ☺️
|
|
|
723
700
|
| Homepage | https://github.com/galtzo-floss/rspec-stubbed_env |
|
|
724
701
|
| Source | https://github.com/galtzo-floss/rspec-stubbed_env |
|
|
725
702
|
| License | `MIT` |
|
|
726
|
-
| Funding | https://github.com/sponsors/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/galtzo-floss, https://thanks.dev/u/gh/pboling, https://
|
|
703
|
+
| Funding | https://github.com/sponsors/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/galtzo-floss, https://thanks.dev/u/gh/pboling, https://www.buymeacoffee.com/pboling |
|
|
727
704
|
<!-- kettle-jem:metadata:end -->
|
|
@@ -48,29 +48,6 @@ module RSpec
|
|
|
48
48
|
def add_hidden_key(key)
|
|
49
49
|
key = key.to_s # Support symbols by forcing to string
|
|
50
50
|
remember_hidden_key(key)
|
|
51
|
-
hide_brackets(key)
|
|
52
|
-
hide_fetch(key)
|
|
53
|
-
hide_values_at
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def hide_brackets(key)
|
|
57
|
-
allow(ENV).to(receive(:[]).with(key).and_return(nil))
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def hide_fetch(key)
|
|
61
|
-
allow(ENV).to(receive(:fetch).with(key)) do |_|
|
|
62
|
-
raise KeyError, "key not found: \"#{key}\""
|
|
63
|
-
end
|
|
64
|
-
allow(ENV).to(receive(:fetch).with(key, anything)) do |_, default_val|
|
|
65
|
-
default_val
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# Rides on the fetch hider!
|
|
70
|
-
def hide_values_at
|
|
71
|
-
allow(ENV).to(receive(:values_at)) do |*args|
|
|
72
|
-
args.map { |arg| ENV.fetch(arg, nil) }
|
|
73
|
-
end
|
|
74
51
|
end
|
|
75
52
|
end
|
|
76
53
|
end
|
|
@@ -55,48 +55,50 @@ module RSpec
|
|
|
55
55
|
allow(ENV).to(receive(:to_h) { mixed_env_hash })
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
STUBBED_KEY = "__STUBBED__"
|
|
61
|
-
|
|
62
|
-
def add_stubbed_value(key, value, track: true)
|
|
63
|
-
key = key.to_s # Support symbols by forcing to string
|
|
64
|
-
remember_stubbed_value(key, value) if track
|
|
65
|
-
allow_brackets(key, value)
|
|
66
|
-
allow_fetch(key, value)
|
|
67
|
-
allow_values_at
|
|
58
|
+
def env_stubbed?
|
|
59
|
+
instance_variable_defined?(:@__rspec_stubbed_env_mutations) && !@__rspec_stubbed_env_mutations.empty?
|
|
68
60
|
end
|
|
69
61
|
|
|
70
|
-
def
|
|
71
|
-
|
|
62
|
+
def init_stub
|
|
63
|
+
@__rspec_stubbed_env_mutations ||= []
|
|
64
|
+
install_env_accessors
|
|
65
|
+
add_stubbed_value(STUBBED_KEY, true, :track => false)
|
|
72
66
|
end
|
|
73
67
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
# Install ONE block-backed receive per accessor instead of per-key
|
|
69
|
+
# `.with(key)` expectations. Per-key expectations collide when the same
|
|
70
|
+
# key is stubbed again in a later example after the earlier expectation
|
|
71
|
+
# has been invoked — rspec-mocks raises "message expectation ... has
|
|
72
|
+
# already been invoked and cannot be modified further" (observed as a
|
|
73
|
+
# seed-dependent CI failure). The blocks read the mutation ledger at
|
|
74
|
+
# call time, so later stub_env / hide_env calls only append to it.
|
|
75
|
+
def install_env_accessors
|
|
76
|
+
allow(ENV).to(receive(:[]) { |key| mixed_env_hash[key] })
|
|
77
|
+
allow(ENV).to(receive(:fetch) do |key, *rest, &default_block|
|
|
78
|
+
hidden = @__rspec_stubbed_env_mutations.reverse.any? do |op, k, _|
|
|
79
|
+
op == :hide && k == key
|
|
80
|
+
end
|
|
81
|
+
value = mixed_env_hash[key]
|
|
82
|
+
if hidden && value.nil?
|
|
83
|
+
unless rest.empty?
|
|
84
|
+
next rest.first
|
|
85
|
+
end
|
|
86
|
+
next default_block.call if default_block
|
|
87
|
+
|
|
88
|
+
raise KeyError, %(key not found: "#{key}")
|
|
89
|
+
end
|
|
90
|
+
if value.nil?
|
|
91
|
+
next rest.first unless rest.empty?
|
|
92
|
+
next default_block.call if default_block
|
|
93
|
+
end
|
|
80
94
|
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
value
|
|
96
|
+
end)
|
|
83
97
|
allow(ENV).to(receive(:values_at)) do |*args|
|
|
84
|
-
args.map { |arg|
|
|
98
|
+
args.map { |arg| mixed_env_hash[arg] }
|
|
85
99
|
end
|
|
86
100
|
end
|
|
87
101
|
|
|
88
|
-
def env_stubbed?
|
|
89
|
-
ENV.fetch(STUBBED_KEY, nil)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def init_stub
|
|
93
|
-
@__rspec_stubbed_env_mutations ||= []
|
|
94
|
-
allow(ENV).to(receive(:[]).and_call_original)
|
|
95
|
-
allow(ENV).to(receive(:fetch).and_call_original)
|
|
96
|
-
allow(ENV).to(receive(:values_at).and_call_original)
|
|
97
|
-
add_stubbed_value(STUBBED_KEY, true, :track => false)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
102
|
def remember_stubbed_value(key, value)
|
|
101
103
|
@__rspec_stubbed_env_mutations ||= []
|
|
102
104
|
@__rspec_stubbed_env_mutations << [:stub, key, value]
|
|
@@ -118,6 +120,15 @@ module RSpec
|
|
|
118
120
|
end
|
|
119
121
|
end
|
|
120
122
|
end
|
|
123
|
+
|
|
124
|
+
private
|
|
125
|
+
|
|
126
|
+
STUBBED_KEY = "__STUBBED__"
|
|
127
|
+
|
|
128
|
+
def add_stubbed_value(key, value, track: true)
|
|
129
|
+
key = key.to_s # Support symbols by forcing to string
|
|
130
|
+
remember_stubbed_value(key, value) if track
|
|
131
|
+
end
|
|
121
132
|
end
|
|
122
133
|
end
|
|
123
134
|
end
|
|
@@ -5,7 +5,7 @@ module RSpec
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION = "1.0.
|
|
8
|
+
VERSION = "1.0.18"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-stubbed_env
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -48,7 +48,7 @@ dependencies:
|
|
|
48
48
|
version: '3.1'
|
|
49
49
|
- - ">="
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: 3.1.
|
|
51
|
+
version: 3.1.28
|
|
52
52
|
type: :development
|
|
53
53
|
prerelease: false
|
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -58,7 +58,7 @@ dependencies:
|
|
|
58
58
|
version: '3.1'
|
|
59
59
|
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 3.1.
|
|
61
|
+
version: 3.1.28
|
|
62
62
|
- !ruby/object:Gem::Dependency
|
|
63
63
|
name: bundler-audit
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -116,7 +116,7 @@ dependencies:
|
|
|
116
116
|
version: '0.1'
|
|
117
117
|
- - ">="
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
|
-
version: 0.1.
|
|
119
|
+
version: 0.1.5
|
|
120
120
|
type: :development
|
|
121
121
|
prerelease: false
|
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -126,7 +126,7 @@ dependencies:
|
|
|
126
126
|
version: '0.1'
|
|
127
127
|
- - ">="
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: 0.1.
|
|
129
|
+
version: 0.1.5
|
|
130
130
|
- !ruby/object:Gem::Dependency
|
|
131
131
|
name: appraisal2
|
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -136,7 +136,7 @@ dependencies:
|
|
|
136
136
|
version: '3.2'
|
|
137
137
|
- - ">="
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: 3.2.
|
|
139
|
+
version: 3.2.6
|
|
140
140
|
type: :development
|
|
141
141
|
prerelease: false
|
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -146,7 +146,7 @@ dependencies:
|
|
|
146
146
|
version: '3.2'
|
|
147
147
|
- - ">="
|
|
148
148
|
- !ruby/object:Gem::Version
|
|
149
|
-
version: 3.2.
|
|
149
|
+
version: 3.2.6
|
|
150
150
|
- !ruby/object:Gem::Dependency
|
|
151
151
|
name: kettle-test
|
|
152
152
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -156,7 +156,7 @@ dependencies:
|
|
|
156
156
|
version: '2.0'
|
|
157
157
|
- - ">="
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 2.0.
|
|
159
|
+
version: 2.0.29
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -166,27 +166,27 @@ dependencies:
|
|
|
166
166
|
version: '2.0'
|
|
167
167
|
- - ">="
|
|
168
168
|
- !ruby/object:Gem::Version
|
|
169
|
-
version: 2.0.
|
|
169
|
+
version: 2.0.29
|
|
170
170
|
- !ruby/object:Gem::Dependency
|
|
171
171
|
name: turbo_tests2
|
|
172
172
|
requirement: !ruby/object:Gem::Requirement
|
|
173
173
|
requirements:
|
|
174
174
|
- - "~>"
|
|
175
175
|
- !ruby/object:Gem::Version
|
|
176
|
-
version: '
|
|
176
|
+
version: '4.0'
|
|
177
177
|
- - ">="
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
|
-
version:
|
|
179
|
+
version: 4.0.0
|
|
180
180
|
type: :development
|
|
181
181
|
prerelease: false
|
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
|
184
184
|
- - "~>"
|
|
185
185
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '
|
|
186
|
+
version: '4.0'
|
|
187
187
|
- - ">="
|
|
188
188
|
- !ruby/object:Gem::Version
|
|
189
|
-
version:
|
|
189
|
+
version: 4.0.0
|
|
190
190
|
- !ruby/object:Gem::Dependency
|
|
191
191
|
name: ruby-progressbar
|
|
192
192
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -210,7 +210,7 @@ dependencies:
|
|
|
210
210
|
version: '1.0'
|
|
211
211
|
- - ">="
|
|
212
212
|
- !ruby/object:Gem::Version
|
|
213
|
-
version: 1.0.
|
|
213
|
+
version: 1.0.10
|
|
214
214
|
type: :development
|
|
215
215
|
prerelease: false
|
|
216
216
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -220,7 +220,7 @@ dependencies:
|
|
|
220
220
|
version: '1.0'
|
|
221
221
|
- - ">="
|
|
222
222
|
- !ruby/object:Gem::Version
|
|
223
|
-
version: 1.0.
|
|
223
|
+
version: 1.0.10
|
|
224
224
|
- !ruby/object:Gem::Dependency
|
|
225
225
|
name: gitmoji-regex
|
|
226
226
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -230,7 +230,7 @@ dependencies:
|
|
|
230
230
|
version: '2.0'
|
|
231
231
|
- - ">="
|
|
232
232
|
- !ruby/object:Gem::Version
|
|
233
|
-
version: 2.0.
|
|
233
|
+
version: 2.0.15
|
|
234
234
|
type: :development
|
|
235
235
|
prerelease: false
|
|
236
236
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -240,7 +240,7 @@ dependencies:
|
|
|
240
240
|
version: '2.0'
|
|
241
241
|
- - ">="
|
|
242
242
|
- !ruby/object:Gem::Version
|
|
243
|
-
version: 2.0.
|
|
243
|
+
version: 2.0.15
|
|
244
244
|
- !ruby/object:Gem::Dependency
|
|
245
245
|
name: rspec
|
|
246
246
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -305,10 +305,10 @@ licenses:
|
|
|
305
305
|
- MIT
|
|
306
306
|
metadata:
|
|
307
307
|
homepage_uri: https://rspec-stubbed-env.galtzo.com/
|
|
308
|
-
source_code_uri: https://github.com/galtzo-floss/rspec-stubbed_env/tree/v1.0.
|
|
309
|
-
changelog_uri: https://github.com/galtzo-floss/rspec-stubbed_env/blob/v1.0.
|
|
308
|
+
source_code_uri: https://github.com/galtzo-floss/rspec-stubbed_env/tree/v1.0.18
|
|
309
|
+
changelog_uri: https://github.com/galtzo-floss/rspec-stubbed_env/blob/v1.0.18/CHANGELOG.md
|
|
310
310
|
bug_tracker_uri: https://github.com/galtzo-floss/rspec-stubbed_env/issues
|
|
311
|
-
documentation_uri: https://www.rubydoc.info/gems/rspec-stubbed_env/1.0.
|
|
311
|
+
documentation_uri: https://www.rubydoc.info/gems/rspec-stubbed_env/1.0.18
|
|
312
312
|
funding_uri: https://github.com/sponsors/pboling
|
|
313
313
|
wiki_uri: https://github.com/galtzo-floss/rspec-stubbed_env/wiki
|
|
314
314
|
news_uri: https://www.railsbling.com/tags/rspec-stubbed_env
|
|
@@ -338,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
338
338
|
- !ruby/object:Gem::Version
|
|
339
339
|
version: '0'
|
|
340
340
|
requirements: []
|
|
341
|
-
rubygems_version: 4.0.
|
|
341
|
+
rubygems_version: 4.0.24
|
|
342
342
|
specification_version: 4
|
|
343
343
|
summary: "\U0001FAE5 Unobtrusively stub ENV keys and values during testing"
|
|
344
344
|
test_files: []
|
metadata.gz.sig
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
u���lu��-�`�S��"6�BB�7mHf�k�Jה�|lK�7��C
|
|
2
|
+
6���F� Z�����EV(�d���f�6tI��SH*L���]�)~ld�mX����<�&d�~���ҡ�M�Ա�`g�XJ�0u1��ɬ�)=`��31H��90!>
|
|
3
|
+
T�}��JI5���:�����B��Y;&�ru�B�f�J����U����e���{|,m������4.�dH��?f�k���, �mN3އ���<n�T��͊N�Y���yǽ����&�O@ۘv���������R�4֗U'�'g�]3Ărm�*yHQ������>��N[�<�?�V����/k�˸�`=���g� �lc���+f_(Td��/�.��
|