sus 0.25.0 → 0.27.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88e89c692361d4e74fc5324690a26161d3537d605353a8361963f2201da78af5
4
- data.tar.gz: 79948d439e9287b15e5f3f10eca380839d832d5aced0e73b6cb1204742c7a0f2
3
+ metadata.gz: 15dd552861dc2a448ac4717e95092d21b76e9f09e50492269a898c8d7db464e3
4
+ data.tar.gz: 47e84419dadb77bfa29e82b8383f7ae90b18d8a170cdd4136e2ef75f3f5afb38
5
5
  SHA512:
6
- metadata.gz: 52ed1bf39fe2a50915ca29b340f2cc5b06a9dec0ad17644cdc8c664d1000e326fc7cfd0d5d749508c6543714cd99d92abe8445e09666cf761707cf9dae5fd592
7
- data.tar.gz: 58e5b06f1333838ef7d207e2211a072157c712d28f2f9e7d2f018a8485622f73c362c0356bdec3e9efa26537c6d52e3f8ead3d1d697f98f416a9aa1e2837c896
6
+ metadata.gz: aa482cd7ea24f6b6f5b32f59582403171ecf8695f490edc0a1149366566d05424e8199d813f4ff0cbd5ef6b2abd327013f35b112a84c905bba62ded1bee9e478
7
+ data.tar.gz: 3bf33b5fdcf42584ba46e360b9a83367b2f09ebc15a6b23497f2485fcd105ea5c354e10e4a15b084624aff8af2a506305771e9edd4754cc7b7e700a99fd50683
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/sus/mock.rb CHANGED
@@ -62,6 +62,23 @@ module Sus
62
62
 
63
63
  return self
64
64
  end
65
+
66
+ # Wrap a method, yielding the original method as the first argument, so you can call it from within the hook.
67
+ def wrap(method, &hook)
68
+ execution_context = Thread.current
69
+
70
+ @interceptor.define_method(method) do |*arguments, **options, &block|
71
+ if execution_context == Thread.current
72
+ original = proc do |*arguments, **options|
73
+ super(*arguments, **options)
74
+ end
75
+
76
+ hook.call(original, *arguments, **options, &block)
77
+ else
78
+ super(*arguments, **options, &block)
79
+ end
80
+ end
81
+ end
65
82
  end
66
83
 
67
84
  module Mocks
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2023, by Samuel Williams.
4
+ # Copyright, 2023-2024, by Samuel Williams.
5
5
 
6
6
  module Sus
7
7
  # Styled output output.
@@ -54,16 +54,20 @@ module Sus
54
54
  [:errored, "⚠ "]
55
55
  end
56
56
 
57
- def error(error, identity)
57
+ def error(error, identity, prefix = error_prefix)
58
58
  lines = error.message.split(/\r?\n/)
59
59
 
60
- self.puts(:indent, *error_prefix, error.class, ": ", lines.shift)
60
+ self.puts(:indent, *prefix, error.class, ": ", lines.shift)
61
61
 
62
62
  lines.each do |line|
63
63
  self.puts(:indent, line)
64
64
  end
65
65
 
66
66
  self.write(Output::Backtrace.for(error, identity))
67
+
68
+ if cause = error.cause
69
+ self.error(cause, identity, ["Caused by ", :errored])
70
+ end
67
71
  end
68
72
 
69
73
  def inform_prefix
data/lib/sus/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.25.0"
7
+ VERSION = "0.27.0"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2024-04-24 00:00:00.000000000 Z
41
+ date: 2024-06-23 00:00:00.000000000 Z
42
42
  dependencies: []
43
43
  description:
44
44
  email:
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubygems_version: 3.5.3
126
+ rubygems_version: 3.5.11
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: A fast and scalable test runner.
metadata.gz.sig CHANGED
Binary file