pry-rescue 1.5.1 → 1.5.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 +8 -0
- data/README.md +0 -17
- data/Rakefile +1 -0
- data/bin/rescue +3 -2
- data/lib/pry-rescue/rspec.rb +19 -16
- data/pry-rescue.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 785059388e26fc08a04afc6d370b89efdc4506f3882738444e2ab0b99c229f20
|
4
|
+
data.tar.gz: 11ab228ba3b614eef01ba6687c97a36c76411245fdc6bcb03aaaaf9cd2a3c59c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ebeff09115b1ad7937b09e42ced421309b24d9674f7edab5d4f9c6acb504778de1506732220f687f81ebccdb0b16b1c34e49bed0c294b980a6eb3701e6d9d1a
|
7
|
+
data.tar.gz: 5c4ecf866a9d06f07447bab62cb51046e40cecbc8ad8cac796c7e40e573ce6c8ceda1a390e6d457a9eef146d9e2c8be79336025515c59188690d8567bc244f47
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v1.5.2 (24 June 2020)
|
2
|
+
* RSpec: Fix Rescue opening after transactional tests are rolled back.
|
3
|
+
(issue #99 - PR #118) (@joallard)
|
4
|
+
|
5
|
+
* bin/rescue: Use realpaths (issue #109 - PR #110)
|
6
|
+
|
7
|
+
*(Damien Robert)*
|
8
|
+
|
1
9
|
## v1.5.1 (22 May 2020)
|
2
10
|
* Make Binding#source_location polyfill. (Removes deprecation warnings
|
3
11
|
for Ruby 2.6+)
|
data/README.md
CHANGED
@@ -84,7 +84,6 @@ browser on unhandled exceptions, and [pry-rails](https://github.com/rweng/pry-ra
|
|
84
84
|
adds some Rails specific helpers to Pry, and replaces `rails console` by Pry.
|
85
85
|
|
86
86
|
### RSpec
|
87
|
-
**ActiveRecord users: see below caveat**
|
88
87
|
|
89
88
|
If you're using [RSpec](https://rspec.org) or
|
90
89
|
[respec](https://github.com/oggy/respec), you can open a Pry session on
|
@@ -106,26 +105,10 @@ RSpec::Expectations::ExpectationNotMetError: expected: 0.3
|
|
106
105
|
[1] pry(main)>
|
107
106
|
```
|
108
107
|
|
109
|
-
### Important caveat when using with Rails/ActiveRecord and transactional fixtures
|
110
|
-
> Records are missing but should be there! Am I losing track of reality?
|
111
|
-
|
112
|
-
You are not. (Probably.)
|
113
|
-
|
114
|
-
By default, RSpec runs test examples in a transaction, and rolls it back when done.
|
115
|
-
By the time Pry-Rescue fires, the transaction has already been rolled back and records are gone!
|
116
|
-
|
117
|
-
A good sanity check is to call `Model.all`. It will usually be empty. However, at the time of the test, they were truly there.
|
118
|
-
|
119
|
-
This bug is currently tracked at [#99](https://github.com/ConradIrwin/pry-rescue/issues/99).
|
120
|
-
|
121
|
-
Current workaround: Pry-Rescue can't be used, but you can use `binding.pry` inside the test. You'll have access to all records you need there.
|
122
|
-
|
123
|
-
### Using pry `edit`
|
124
108
|
Unfortunately using `edit -c` to edit `_spec.rb` files does not yet reload the
|
125
109
|
code in a way that the `try-again` command can understand. You can still use
|
126
110
|
`try-again` if you edit code that is not in spec files.
|
127
111
|
|
128
|
-
### Always enabled
|
129
112
|
If you want pry-rescue to *always* be enabled when you run tests, simply add this line to your `test_helper.rb`:
|
130
113
|
|
131
114
|
```ruby
|
data/Rakefile
CHANGED
data/bin/rescue
CHANGED
@@ -40,7 +40,7 @@ else
|
|
40
40
|
ENV['PRY_RESCUE_RAILS'] = 'true'
|
41
41
|
exec(*ARGV)
|
42
42
|
when 'rake'
|
43
|
-
require File.expand_path('../../lib/pry-rescue.rb', __FILE__)
|
43
|
+
require File.realpath(File.expand_path('../../lib/pry-rescue.rb', __FILE__))
|
44
44
|
PryRescue.load_rake ARGV[1]
|
45
45
|
exit
|
46
46
|
when /^re?spec$/
|
@@ -51,8 +51,9 @@ end
|
|
51
51
|
|
52
52
|
if script = ARGV.shift
|
53
53
|
$0 = File.expand_path(script)
|
54
|
+
|
54
55
|
if File.exists? script
|
55
|
-
require File.expand_path('../../lib/pry-rescue.rb', __FILE__)
|
56
|
+
require File.realpath(File.expand_path('../../lib/pry-rescue.rb', __FILE__))
|
56
57
|
PryRescue.load $0, ensure_repl
|
57
58
|
else
|
58
59
|
$stderr.puts "Error: #{script.inspect} not found."
|
data/lib/pry-rescue/rspec.rb
CHANGED
@@ -8,29 +8,23 @@ class PryRescue
|
|
8
8
|
# Run an Rspec example within Pry::rescue{ }.
|
9
9
|
#
|
10
10
|
# Takes care to ensure that `try-again` will work.
|
11
|
+
#
|
12
|
+
# `example` is a RSpec::Core::Example::Procsy
|
11
13
|
def self.run(example)
|
12
14
|
Pry::rescue do
|
13
15
|
begin
|
14
16
|
before
|
15
17
|
|
16
|
-
example.
|
17
|
-
example.
|
18
|
-
|
19
|
-
example.binding.eval('@example && @example.example_group_instance.instance_variable_set(:@__init_memoized, true)')
|
20
|
-
example.binding.eval('example.example_group_instance.instance_variable_set(:@__init_memoized, true) if defined?(example)')
|
21
|
-
else
|
22
|
-
example.binding.eval('@example && @example.example_group_instance.instance_variable_set(:@__memoized, {})')
|
23
|
-
example.binding.eval('example.example_group_instance.instance_variable_set(:@__memoized, {}) if defined?(example)')
|
24
|
-
end
|
18
|
+
example.example.instance_variable_set(:@exception, nil)
|
19
|
+
example.example_group_instance.instance_variable_set(:@__init_memoized, true)
|
20
|
+
|
25
21
|
example.run
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Pry::rescued(e)
|
30
|
-
end
|
22
|
+
|
23
|
+
# Rescued will be called in :after hook, which is ran before the second
|
24
|
+
# :around leg
|
31
25
|
|
32
26
|
ensure
|
33
|
-
|
27
|
+
after_outside
|
34
28
|
end
|
35
29
|
end
|
36
30
|
end
|
@@ -39,7 +33,12 @@ class PryRescue
|
|
39
33
|
monkeypatch_capybara if defined?(Capybara)
|
40
34
|
end
|
41
35
|
|
42
|
-
def self.after
|
36
|
+
def self.after(example)
|
37
|
+
e = example.exception
|
38
|
+
Pry::rescued(e) if e
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.after_outside
|
43
42
|
after_filters.each(&:call)
|
44
43
|
end
|
45
44
|
|
@@ -68,4 +67,8 @@ RSpec.configure do |c|
|
|
68
67
|
c.around(:each) do |example|
|
69
68
|
PryRescue::RSpec.run example
|
70
69
|
end
|
70
|
+
|
71
|
+
c.after(:each) do |example|
|
72
|
+
PryRescue::RSpec.after(example)
|
73
|
+
end
|
71
74
|
end
|
data/pry-rescue.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'pry-rescue'
|
3
|
-
s.version = '1.5.
|
3
|
+
s.version = '1.5.2'
|
4
4
|
s.summary = 'Open a pry session on any unhandled exceptions'
|
5
5
|
s.description = 'Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions'
|
6
6
|
s.homepage = 'https://github.com/ConradIrwin/pry-rescue'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-rescue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conrad Irwin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pry
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
195
|
+
rubygems_version: 3.1.2
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Open a pry session on any unhandled exceptions
|