minitest-markdown 0.2.0.pre → 0.2.1.pre

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: 50ca2163359f3e4b038a8e4837bcb38511bca5e5b00bc2603873816bba2408e1
4
- data.tar.gz: 15fcbc54bcc387111b92b86fe5c291ce82d05f9391f12d41955aaa0d191c2735
3
+ metadata.gz: 959c342f3e4ec34238e2385e3578faf1d5133beb2f74d9b52d4ffc9ab0dc8d58
4
+ data.tar.gz: 8b4bae7c2888040d6b2124fa2bd5d103c67405c883bf3de606f220e317912249
5
5
  SHA512:
6
- metadata.gz: 26bba54a86204e035f3890032eb985ac494133a697fc79c937ed863270e7659acb8675e916aba14b83062b1cb162b5ca7ef7a73e3283ad2c80b95889e8fac356
7
- data.tar.gz: f6556b67590972e176b120c879d499d00fc2bc0574c1f134bec9f76c12f6f37907b2b1c09fb19aab7e73d41bd697bdf37c289f2180797b8f4940043935441043
6
+ metadata.gz: e3d59e3fc4f77092cdd8dda4f3a0b8a8d79e1b73cbfc37186947efd6dbb0e35f508ab0d32da4f6a88d4c816d72370ff92b563e819c44073da4ea44404b946acb
7
+ data.tar.gz: 2522d752e44a422f82be9ccb1a44c9ddec8346381d2cb0465990a7eee5b383e0a6b664c7f7b52c9ba860602c2a78411dc9f225c4a580bc287f65c26fbace05ad
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.1.pre] - 2025-05-07
4
+
5
+ - Fix issue with require in eval
6
+ - Fix bug in StubChain where instance was mutated after #call
7
+
3
8
  ## [0.2.0.pre] - 2025-05-06
4
9
 
5
10
  - Add ability to pass any number of stubs to a test code block
data/README.md CHANGED
@@ -110,7 +110,9 @@ class MarkdownTest < Minitest::Test
110
110
  array_stubs_size = Minitest::StubChain.stubproc(Array, :size, 42, any_instance: true) # uses the bundled minitest-stub_any_instance gem
111
111
 
112
112
  stubs = {}
113
- stubs[8] = Minitest::StubChain.new([set_stubs_new, array_stubs_size]) # initialized with zero or more stub procs
113
+ @stub_chain = Minitest::StubChain.new([set_stubs_new, array_stubs_size]) # initialized with zero or more stub procs
114
+ stubs[8] = @stub_chain
115
+ stubs[9] = @stub_chain # StubChain instances themseves may be reused
114
116
 
115
117
  Markdown.generate_markdown_tests(self, stubs: stubs)
116
118
  end
@@ -122,6 +124,12 @@ The 2 stubs above are demonstated in the following examples:
122
124
  Set.new([1, 'c', :s]).size # Here Set.new was stubbed to return an Array and Array#size was stubbed to return 42
123
125
  # => 42
124
126
  ```
127
+ Example showing the reuse of a StubChain:
128
+ ```ruby
129
+ # This is test_block9
130
+ Set.new([]).size
131
+ # => 42
132
+ ```
125
133
 
126
134
  ## Configuration
127
135
 
@@ -3,6 +3,8 @@
3
3
  require_relative '../assertions_extensions'
4
4
  require_relative 'test_code_block'
5
5
 
6
+ $LOAD_PATH << '.' # fix #2
7
+
6
8
  module Minitest
7
9
  module Markdown
8
10
  # knows how to build a markdown test
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Markdown
5
- VERSION = '0.2.0.pre'
5
+ VERSION = '0.2.1.pre'
6
6
  end
7
7
  end
@@ -20,8 +20,7 @@ module Minitest
20
20
 
21
21
  def call(test_code_proc)
22
22
  validate(test_code_proc)
23
- stubs << test_code_proc
24
- call_recursive
23
+ call_recursive [*stubs, test_code_proc]
25
24
  end
26
25
 
27
26
  private
@@ -32,10 +31,11 @@ module Minitest
32
31
  test_code_proc
33
32
  end
34
33
 
35
- def call_recursive
36
- (prok = stubs.shift).call # "undefined method 'call' for nil" if proc calls a block - i.e. stubs
37
- rescue NoMethodError
38
- prok.call { call_recursive }
34
+ def call_recursive(call_chain)
35
+ prok = call_chain.shift
36
+ return prok.call if call_chain.empty?
37
+
38
+ prok.call { call_recursive(call_chain) }
39
39
  end
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre
4
+ version: 0.2.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - MatzFan