rspec-debugging 0.0.1 → 0.0.2
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 +3 -0
- data/Gemfile.lock +1 -1
- data/lib/rspec/debugging/debug_it.rb +56 -0
- data/lib/rspec/debugging.rb +1 -0
- data/rspec-debugging.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d232979bdf2295fb58cec0c7295355366fb703f74e327d0d87d6d6febc35da9
|
4
|
+
data.tar.gz: 98d1146bb2abb4e83f4308f47f302d74755c1d5b1f2c622ef216390ec25c6496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b22241789c483ef578ef866f7262e263938629486ed90f931f0a09511d3b662b0818cbbccd7cb5f3df2c441be2decdadfd775c6e61c37fcf080b5a100d245bb6
|
7
|
+
data.tar.gz: d537656b7b9d64d8e572a2844e83dfd86450bb1a803a910f58322d5a14ec23d62a6b00e3958f27d5f9bd2ba2d50ab5292abf4a6fe97a7837e341a8c81d7db770
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'debug/session'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Debugging
|
5
|
+
module DebugIt
|
6
|
+
ENABLED = ['1', 'true'].include?(ENV['RSPEC_DEBUGGING'])
|
7
|
+
|
8
|
+
def initialize(example_group_class, description, user_metadata, example_block=nil)
|
9
|
+
return super unless user_metadata[:debug] || ENABLED
|
10
|
+
|
11
|
+
if example_block
|
12
|
+
orig_example_block = example_block
|
13
|
+
|
14
|
+
example_block = Proc.new do
|
15
|
+
e = DEBUGGER__::SESSION.capture_exception_frames /(exe|bin|lib)\/rspec/ do
|
16
|
+
instance_exec(&orig_example_block)
|
17
|
+
end
|
18
|
+
|
19
|
+
if e
|
20
|
+
STDERR.puts <<~MSG
|
21
|
+
|
22
|
+
Error:
|
23
|
+
#{e.message}
|
24
|
+
|
25
|
+
MSG
|
26
|
+
|
27
|
+
DEBUGGER__::SESSION.enter_postmortem_session e
|
28
|
+
raise e
|
29
|
+
end
|
30
|
+
end # Proc.new
|
31
|
+
elsif user_metadata[:debug] && user_metadata[:skip] == RSpec::Core::Pending::NOT_YET_IMPLEMENTED
|
32
|
+
# called with no block
|
33
|
+
user_metadata.delete(:skip)
|
34
|
+
|
35
|
+
file, line = caller[2].split(":")
|
36
|
+
|
37
|
+
example_block = Proc.new do
|
38
|
+
STDERR.puts <<~MSG
|
39
|
+
debugging: #{file}:#{line}
|
40
|
+
|
41
|
+
MSG
|
42
|
+
|
43
|
+
debugger
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
RSpec::Core::Example.prepend RSpec::Debugging::DebugIt
|
54
|
+
RSpec::Core::ExampleGroup.define_example_method(:dit, debug: true, focus: true)
|
55
|
+
RSpec::Core::ExampleGroup.define_example_group_method(:ddescribe, debug: true, focus: true)
|
56
|
+
RSpec::Core::ExampleGroup.define_example_group_method(:dcontext, debug: true, focus: true)
|
data/lib/rspec/debugging.rb
CHANGED
data/rspec-debugging.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.homepage = "https://github.com/dpep/rspec-debugging"
|
6
6
|
s.license = "MIT"
|
7
7
|
s.name = File.basename(__FILE__, ".gemspec")
|
8
|
-
s.summary =
|
9
|
-
s.version = "0.0.
|
8
|
+
s.summary = s.description
|
9
|
+
s.version = "0.0.2"
|
10
10
|
|
11
11
|
s.required_ruby_version = ">= 3.1"
|
12
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-debugging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-expectations
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- README.md
|
80
80
|
- lib/rspec-debugging.rb
|
81
81
|
- lib/rspec/debugging.rb
|
82
|
+
- lib/rspec/debugging/debug_it.rb
|
82
83
|
- lib/rspec/debugging/let_variables.rb
|
83
84
|
- lib/rspec/debugging/version.rb
|
84
85
|
- rspec-debugging.gemspec
|
@@ -104,5 +105,5 @@ requirements: []
|
|
104
105
|
rubygems_version: 3.5.23
|
105
106
|
signing_key:
|
106
107
|
specification_version: 4
|
107
|
-
summary: RSpec
|
108
|
+
summary: Tools to improve debugging in RSpec
|
108
109
|
test_files: []
|