rspec-debugging 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 896e136df71d2e337174b069c599e26004bc84255a13b226abe2d29aea474f1c
4
+ data.tar.gz: 89ce8e417c627add4db5d53896b072fc45b00b25f478f8ee3e383242f837e0f2
5
+ SHA512:
6
+ metadata.gz: 46ba38fe0e0e119b61f3648dc6d9b7e3661bc0fe511f710bab8d711d151c071d5ae086c637e5fe7886b3b6a661aed8175286bb7fbf0316dc6f9c86f68610c080
7
+ data.tar.gz: 48f3376fc2e14099fc319e18dc64169d020eeff444d14b1452e0f75411eeb99aca47e3cc24680fb5ee5206c409c566d41e91b13b5342ce23e93d3a53476a2f4d
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ ### 0.0.1 (2025-01-10)
2
+ - init
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspec-debugging (0.0.1)
5
+ rspec-expectations (>= 3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ debug (1.9.2)
11
+ irb (~> 1.10)
12
+ reline (>= 0.3.8)
13
+ diff-lcs (1.5.1)
14
+ docile (1.4.1)
15
+ io-console (0.7.2)
16
+ irb (1.14.1)
17
+ rdoc (>= 4.0.0)
18
+ reline (>= 0.4.2)
19
+ psych (5.2.0)
20
+ stringio
21
+ rdoc (6.8.1)
22
+ psych (>= 4.0.0)
23
+ reline (0.5.11)
24
+ io-console (~> 0.5)
25
+ rspec (3.13.0)
26
+ rspec-core (~> 3.13.0)
27
+ rspec-expectations (~> 3.13.0)
28
+ rspec-mocks (~> 3.13.0)
29
+ rspec-core (3.13.2)
30
+ rspec-support (~> 3.13.0)
31
+ rspec-expectations (3.13.3)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-mocks (3.13.2)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-support (3.13.1)
38
+ simplecov (0.22.0)
39
+ docile (~> 1.1)
40
+ simplecov-html (~> 0.11)
41
+ simplecov_json_formatter (~> 0.1)
42
+ simplecov-html (0.13.1)
43
+ simplecov_json_formatter (0.1.4)
44
+ stringio (3.1.2)
45
+
46
+ PLATFORMS
47
+ arm64-darwin-24
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ debug
52
+ rspec
53
+ rspec-debugging!
54
+ simplecov
55
+
56
+ BUNDLED WITH
57
+ 2.5.23
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Daniel Pepper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ rspec-debugging
2
+ ======
3
+ ![Gem](https://img.shields.io/gem/dt/rspec-debugging?style=plastic)
4
+ [![codecov](https://codecov.io/gh/dpep/rspec-debugging/branch/main/graph/badge.svg)](https://codecov.io/gh/dpep/rspec-debugging)
5
+
6
+
7
+ Tools to make debugging RSpec easier.
8
+
9
+ ```ruby
10
+ require "rspec/debugging"
11
+
12
+
13
+ ```
14
+
15
+
16
+ ----
17
+ ## Contributing
18
+
19
+ Yes please :)
20
+
21
+ 1. Fork it
22
+ 1. Create your feature branch (`git checkout -b my-feature`)
23
+ 1. Ensure the tests pass (`bundle exec rspec`)
24
+ 1. Commit your changes (`git commit -am 'awesome new feature'`)
25
+ 1. Push your branch (`git push origin my-feature`)
26
+ 1. Create a Pull Request
@@ -0,0 +1,60 @@
1
+ module RSpec
2
+ module Debugging
3
+ module LetVariables
4
+ def let_variables
5
+ let_variable_methods(self).keys
6
+ end
7
+
8
+ def let_variable_initialized?(name)
9
+ __memoized.instance_variable_get("@memoized").key?(name)
10
+ end
11
+
12
+ def let_variable_get(name)
13
+ __memoized.instance_variable_get("@memoized")[name]
14
+ end
15
+
16
+ def let_variable_locations(name)
17
+ let_variable_methods(self)[name].map do |fn|
18
+ normalize_path(fn.source_location.join(":"))
19
+ end
20
+ end
21
+
22
+ def let_variable_values(name)
23
+ let_variable_methods(self)[name].map do |fn|
24
+ {
25
+ normalize_path(fn.source_location.join(":")) => fn.bind(self).call
26
+ }
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ extend self
33
+
34
+ def let_variable_methods(example)
35
+ # find RSpec modules containing `let` blocks
36
+ mods = self.class.ancestors.select {|x| x.to_s.include?('::LetDefinitions') }
37
+
38
+ locations = {}
39
+
40
+ mods.each do |mod|
41
+ mod.instance_methods.each do |method_name|
42
+ locations[method_name] ||= []
43
+ locations[method_name] << mod.instance_method(method_name)
44
+ end
45
+ end
46
+
47
+ locations
48
+ end
49
+
50
+ def normalize_path(path)
51
+ path.delete_prefix(
52
+ Dir.pwd + "/"
53
+ ).gsub(
54
+ %r{.*/gems/},
55
+ ".../gems/"
56
+ ).sub(Dir.home, "~")
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,5 @@
1
+ module RSpec
2
+ module Debugging
3
+ VERSION = Gem.loaded_specs["rspec-debugging"].version.to_s
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "rspec/expectations"
2
+
3
+ require "rspec/debugging/let_variables"
4
+ require "rspec/debugging/version"
5
+
6
+ RSpec.configure do |config|
7
+ config.include RSpec::Debugging::LetVariables
8
+ end
@@ -0,0 +1 @@
1
+ require "rspec/debugging"
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.authors = ["Daniel Pepper"]
3
+ s.description = "Tools to improve debugging in RSpec"
4
+ s.files = `git ls-files * ':!:spec'`.split("\n")
5
+ s.homepage = "https://github.com/dpep/rspec-debugging"
6
+ s.license = "MIT"
7
+ s.name = File.basename(__FILE__, ".gemspec")
8
+ s.summary = "RSpec::Debugging"
9
+ s.version = "0.0.1"
10
+
11
+ s.required_ruby_version = ">= 3.1"
12
+
13
+ s.add_dependency "rspec-expectations", ">= 3"
14
+
15
+ s.add_development_dependency "debug"
16
+ s.add_development_dependency "rspec"
17
+ s.add_development_dependency "simplecov"
18
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-debugging
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Pepper
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-01-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec-expectations
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: debug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Tools to improve debugging in RSpec
70
+ email:
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - CHANGELOG.md
76
+ - Gemfile
77
+ - Gemfile.lock
78
+ - LICENSE.txt
79
+ - README.md
80
+ - lib/rspec-debugging.rb
81
+ - lib/rspec/debugging.rb
82
+ - lib/rspec/debugging/let_variables.rb
83
+ - lib/rspec/debugging/version.rb
84
+ - rspec-debugging.gemspec
85
+ homepage: https://github.com/dpep/rspec-debugging
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '3.1'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 3.5.23
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: RSpec::Debugging
108
+ test_files: []