finishing_moves 0.12 → 0.13
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/lib/finishing_moves/kernel.rb +10 -0
- data/lib/finishing_moves/version.rb +1 -1
- data/spec/kernel_spec.rb +51 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e83beb44f31e133f35900b3e4b2dd3c6a0bb1b7
|
4
|
+
data.tar.gz: 3f1d6578baff446873c089be7103a72cc9c66d5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36212ac6505a5705703b4855e50ed524e820df417d9e082b1696eb7c2b4be4860b76c5e4d18197fd115a49bafc884964cbf22cf4c4373347a1ad0d3fad369080
|
7
|
+
data.tar.gz: 2eb008c733f17451d67cb91f5433ce864ffe29c4e53f00a5aa385ef630979b6f2d03722fa4a8f04f6d4ec442b35625c5db33437ce247a037abdb7f531a1e9226
|
data/spec/kernel_spec.rb
CHANGED
@@ -59,6 +59,47 @@ describe Kernel do
|
|
59
59
|
expect(test_cascade('foobar')).to eq 4
|
60
60
|
end
|
61
61
|
|
62
|
+
it "#silently" do
|
63
|
+
# lots of overlap with nil_chain, so...
|
64
|
+
expect(silently{bogus_variable}).to eq nil
|
65
|
+
expect(silently{bogus_hash[:foo]}).to eq nil
|
66
|
+
params = { :foo => 'bar' }
|
67
|
+
expect(silently{ params[:bogus_key] }).to eq nil
|
68
|
+
expect(silently{ params[:foo] }).to eq 'bar'
|
69
|
+
var = 'a simple string'
|
70
|
+
expect(silently{ var.transmogrify }).to eq nil
|
71
|
+
|
72
|
+
c = C.new
|
73
|
+
b = B.new c
|
74
|
+
a = A.new b
|
75
|
+
expect(a.b.c.hello).to eq "Hello, world!"
|
76
|
+
b.c = nil
|
77
|
+
expect(silently{a.b.c.hello}).to eq nil
|
78
|
+
a = nil
|
79
|
+
expect(silently{a.b.c.hello}).to eq nil
|
80
|
+
|
81
|
+
expect( silently(true) { bogus_variable } ).to equal true
|
82
|
+
expect( silently(false) { bogus_variable } ).to equal false
|
83
|
+
expect( silently('gotcha!') { bogus_variable } ).to eq 'gotcha!'
|
84
|
+
expect( silently('gotcha!') { params[:bogus_key] } ).to eq 'gotcha!'
|
85
|
+
expect( silently('gotcha!') { params[:foo] } ).to eq 'bar'
|
86
|
+
|
87
|
+
# and here's the new sauce
|
88
|
+
expect(silently{raise}).to eq nil
|
89
|
+
expect(silently{raise "oops"}).to eq nil
|
90
|
+
expect(silently{raise StandardError}).to eq nil
|
91
|
+
expect(silently{raise ArgumentError}).to eq nil
|
92
|
+
expect(silently{raise RuntimeError}).to eq nil
|
93
|
+
expect(silently{raise NoMethodError}).to eq nil
|
94
|
+
expect(silently{raise NameError}).to eq nil
|
95
|
+
|
96
|
+
# leave system-level stuff alone
|
97
|
+
expect{ silently{raise Exception} }.to raise_error(Exception)
|
98
|
+
expect{ silently{raise SystemExit} }.to raise_error(SystemExit)
|
99
|
+
expect{ silently{raise NoMemoryError} }.to raise_error(NoMemoryError)
|
100
|
+
expect{ silently{raise SignalException.new(0)} }.to raise_error(SignalException)
|
101
|
+
end
|
102
|
+
|
62
103
|
end
|
63
104
|
|
64
105
|
# some small test fixtures
|
@@ -115,3 +156,13 @@ module SomeModule
|
|
115
156
|
end
|
116
157
|
end
|
117
158
|
|
159
|
+
class TestExceptionLibrary
|
160
|
+
class Error < RuntimeError
|
161
|
+
end
|
162
|
+
|
163
|
+
class WidgetError < Error
|
164
|
+
end
|
165
|
+
|
166
|
+
class FrobError < Error
|
167
|
+
end
|
168
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finishing_moves
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.13'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Koehl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08
|
12
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-readline
|