debug_exceptions_json 0.2.0 → 0.2.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc043c13ee091fe6fa664fcf5df7b1e10f1b456
|
4
|
+
data.tar.gz: bba57ccf2f471b9d30d473c58d96967dd5a2887c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 071d1c0211698b37c4d3dfede0350f89d51e6f1c9c1bab33c365006be4573faf252b1ff6d2599764dab2ac6c5d56e392595243328bf85d0c71cdb384e0178cf2
|
7
|
+
data.tar.gz: bca9d8d69fc5e8433fcee0dc0e29f6c70ba48b904fa108dd5ee496b3570034c6d826c08054754bd54b893cb9c29982b5bb8f8203304b1f3406c4bdacb7eb1b43
|
@@ -1,9 +1,27 @@
|
|
1
|
+
# For RSpec2 compatibility
|
2
|
+
require 'rspec/core/formatters/progress_formatter'
|
3
|
+
|
1
4
|
class DebugExceptionsJson
|
2
5
|
module RSpec
|
3
6
|
class Formatter < ::RSpec::Core::Formatters::ProgressFormatter
|
4
|
-
|
7
|
+
# For RSpec2 compatibility
|
8
|
+
RSPEC3 = ::RSpec::Core::Version::STRING.split('.').first == "3"
|
9
|
+
|
10
|
+
if RSPEC3
|
11
|
+
::RSpec::Core::Formatters.register self, :dump_failures
|
12
|
+
end
|
13
|
+
|
14
|
+
def dump_failures(notification = nil)
|
15
|
+
if RSPEC3
|
16
|
+
dump_failures_3(notification)
|
17
|
+
else
|
18
|
+
dump_failures_2
|
19
|
+
end
|
20
|
+
end
|
5
21
|
|
6
|
-
|
22
|
+
private
|
23
|
+
|
24
|
+
def dump_failures_3(notification)
|
7
25
|
return if notification.failure_notifications.empty?
|
8
26
|
|
9
27
|
colorizer = ::RSpec::Core::Formatters::ConsoleCodes
|
@@ -29,7 +47,30 @@ class DebugExceptionsJson
|
|
29
47
|
output.puts formatted
|
30
48
|
end
|
31
49
|
|
32
|
-
|
50
|
+
def dump_failures_2
|
51
|
+
return if failed_examples.empty?
|
52
|
+
output.puts
|
53
|
+
output.puts "Failures:"
|
54
|
+
failed_examples.each_with_index do |example, index|
|
55
|
+
output.puts
|
56
|
+
pending_fixed?(example) ? dump_pending_fixed(example, index) : dump_failure(example, index)
|
57
|
+
dump_backtrace(example)
|
58
|
+
|
59
|
+
response = example.metadata[:response]
|
60
|
+
|
61
|
+
if response.server_error?
|
62
|
+
begin
|
63
|
+
e = JSON(response.body)['error']
|
64
|
+
rescue JSON::ParserError
|
65
|
+
e = {}
|
66
|
+
end
|
67
|
+
|
68
|
+
if e['exception_class'] && e['message'] && e['backtrace']
|
69
|
+
output.puts error_to_dump_message(e)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
33
74
|
|
34
75
|
# TODO: colorize server error dump?
|
35
76
|
def error_to_dump_message(error)
|
@@ -4,7 +4,14 @@ class DebugExceptionsJson
|
|
4
4
|
def self.included(base)
|
5
5
|
base.instance_eval do
|
6
6
|
after do |example|
|
7
|
-
|
7
|
+
# For RSpec2 compatibility
|
8
|
+
if ::RSpec::Core::Version::STRING.split('.').first == "3"
|
9
|
+
example.metadata[:response] = example.instance_exec { response }
|
10
|
+
else
|
11
|
+
# RSpec2 passes ExampleGroup::Nested_N
|
12
|
+
nested = example
|
13
|
+
nested.example.metadata[:response] = nested.example.instance_eval { response }
|
14
|
+
end
|
8
15
|
end
|
9
16
|
end
|
10
17
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debug_exceptions_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taiki Ono
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rspec
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.0.0
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.0.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rails
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +38,6 @@ dependencies:
|
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: 1.3.9
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec-rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 3.0.2
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 3.0.2
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: pry-rails
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|