minitest-markdown 1.0.0 → 1.0.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: 015b8f6b5682bb503a135d9bf92e8117e886ba3c5295610304e1257a8e2c22ee
4
- data.tar.gz: 5bd8d78d2ae84c3d3d8281415d650c6bc3fa2aee891f08b46e06deb91cb7ba6f
3
+ metadata.gz: 4ce194c19e7860fad853a2c1763a1f0b68cecc43ae7a9ad1c80a2f59e3d435e6
4
+ data.tar.gz: a6bf5cabf787284659443e0048332a4a0b58c3bba5d4bfe0b84a3d88c767bf66
5
5
  SHA512:
6
- metadata.gz: 02c981b56ae1ebadbab75f554f051ceebf87bd6443f471de057f4a7fe1ff1c2744fa487ccbd815a368663fea84507a7be68422a0fb8d73e22db6624f1c74ebd0
7
- data.tar.gz: 67052f7b7e655abc0da17630833ebf64ea85927d425bd42c1ef017a2eef1ade104eaf44820bb631ca1b5b7067be77490dc7a91e712553e1c7e246b528abf21d2
6
+ metadata.gz: 8c5086120dccfc99db477292686152698821d4ad9230ecec50e6a75134b110a161ca3cd3f554ab568b7fe43034ba8f141a182d5f39c8eb0293a621c596f5291a
7
+ data.tar.gz: 8042550f426f11393f50e470af79120dae04f4c9dd25b1d1a3281d30867c23f09d11fe238b7d36cfcca4afa849a2636c07eade899c6b63dc39cf85f43baedbe3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.1] - 2026-05-31
4
+
5
+ - Include Minitest::Hooks in test class. Fixes [#3](https://gitlab.com/matzfan/minitest-markdown/-/work_items/3)
6
+
3
7
  ## [1.0.0] - 2026-05-22
4
8
 
5
9
  - Minitest 6
@@ -11,7 +11,6 @@ module Minitest
11
11
  class TestClass
12
12
  FENCED_BLOCK_REGEXP = /^```ruby\n(.*?)\n```/m
13
13
 
14
- BAD_KLASS = 'TestClass must be instantiated with Minitest::Test or subclass thereof'
15
14
  BAD_PATH = 'Path does not exist, is not readable or is not a Markdown file:'
16
15
  MD = '.md'
17
16
 
@@ -21,7 +20,7 @@ module Minitest
21
20
  attr_reader :klass, :path
22
21
 
23
22
  def initialize(klass, path: nil)
24
- @klass = validate_class klass
23
+ @klass = klass
25
24
  @path = validate_path path
26
25
  @state_methods_defined = []
27
26
  end
@@ -38,12 +37,6 @@ module Minitest
38
37
 
39
38
  private
40
39
 
41
- def validate_class(klass)
42
- raise ArgumentError, BAD_KLASS unless klass.respond_to?(:ancestors) && klass.ancestors.include?(Minitest::Test)
43
-
44
- klass
45
- end
46
-
47
40
  def validate_path(pth)
48
41
  return Markdown.config.readme_path if pth.nil?
49
42
  raise ArgumentError, "#{BAD_PATH} #{pth}" unless File.exist?(pth) && File.file?(pth) && File.extname(pth) == MD
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Markdown
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'minitest/hooks'
3
4
  require 'minitest/stub_any_instance'
4
5
 
5
6
  require_relative 'stub_chain'
@@ -11,6 +12,7 @@ require_relative 'markdown/test_class'
11
12
  module Minitest
12
13
  # namespace
13
14
  module Markdown
15
+ BAD_KLASS = 'klass keyword takes a subclass of Minitest::Test'
14
16
  ARG_ERR = 'stubs keyword takes a hash. Keys are integers and values are StubChain instances'
15
17
 
16
18
  class << self
@@ -23,10 +25,13 @@ module Minitest
23
25
  end
24
26
 
25
27
  def generate_markdown_tests(klass, path: nil, stubs: {})
28
+ raise ArgumentError, BAD_KLASS unless klass.respond_to?(:ancestors) && klass.ancestors.include?(Test)
26
29
  raise ArgumentError, ARG_ERR unless stubs.is_a? Hash
27
30
  raise ArgumentError, ARG_ERR unless stubs.keys.all?(Integer)
28
31
  raise ArgumentError, ARG_ERR unless stubs.values.all?(StubChain)
29
32
 
33
+ klass.include Hooks
34
+
30
35
  TestClass.new(klass, path: path).define_methods(stubs: stubs)
31
36
  end
32
37
  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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MatzFan
@@ -43,20 +43,34 @@ dependencies:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
45
  version: '6'
46
+ - !ruby/object:Gem::Dependency
47
+ name: minitest-hooks
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.5'
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.5'
46
60
  - !ruby/object:Gem::Dependency
47
61
  name: minitest-mock
48
62
  requirement: !ruby/object:Gem::Requirement
49
63
  requirements:
50
64
  - - "~>"
51
65
  - !ruby/object:Gem::Version
52
- version: '5'
66
+ version: '5.27'
53
67
  type: :runtime
54
68
  prerelease: false
55
69
  version_requirements: !ruby/object:Gem::Requirement
56
70
  requirements:
57
71
  - - "~>"
58
72
  - !ruby/object:Gem::Version
59
- version: '5'
73
+ version: '5.27'
60
74
  - !ruby/object:Gem::Dependency
61
75
  name: minitest-stub_any_instance
62
76
  requirement: !ruby/object:Gem::Requirement