shrimple 0.8.4 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shrimple.rb +2 -1
- data/shrimple.gemspec +1 -1
- data/spec/shrimple_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 310c4b7211c3312385b0a2037f886f953de7dc67
|
4
|
+
data.tar.gz: 2a831b00ab771d0fd85eecf2164d6e1c585f0095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4202f11f06bfc7dec4ddeabd7b26127ab02e2bf352d1e8c874e5a42aed81cf1731e2703aa4e3d272dff402ed902d83c573c35a8d49a11e6f91e93cda6c7cc06e
|
7
|
+
data.tar.gz: 153c56a6fd32b8656d600e5f3173732349126fa2f45b3385a10493e4216b3e0d8559db5929e365713b467b8680f86e414f0a022f0e2a73b513a182894fb357a1
|
data/lib/shrimple.rb
CHANGED
@@ -81,15 +81,16 @@ class Shrimple
|
|
81
81
|
|
82
82
|
def get_full_options src, *inopts
|
83
83
|
exopts = options.dup
|
84
|
+
# can't deep_dup procs so remove them and add them back
|
84
85
|
onSuccess = exopts.delete(:onSuccess)
|
85
86
|
onError = exopts.delete(:onError)
|
86
87
|
|
87
88
|
full_opts = Shrimple.deep_dup(exopts)
|
89
|
+
full_opts.merge!(onSuccess: onSuccess, onError: onError)
|
88
90
|
full_opts.deep_merge!(src) if src && src.kind_of?(Hash)
|
89
91
|
inopts.each { |opt| full_opts.deep_merge!(opt) }
|
90
92
|
full_opts.merge!(input: src) if src && !src.kind_of?(Hash)
|
91
93
|
full_opts.merge!(output: full_opts.delete(:to)) if full_opts[:to]
|
92
|
-
full_opts.merge!(onSuccess: onSuccess, onError: onError)
|
93
94
|
|
94
95
|
self.class.compact!(full_opts)
|
95
96
|
full_opts
|
data/shrimple.gemspec
CHANGED
data/spec/shrimple_spec.rb
CHANGED
@@ -89,6 +89,13 @@ describe Shrimple do
|
|
89
89
|
expect(Shrimple.compact!(s.to_hash)).to eq({'executable' => 'symbol'}.merge(custom_headers))
|
90
90
|
end
|
91
91
|
|
92
|
+
it "properly merges callbacks" do
|
93
|
+
# this is in response to a bug where it was impossible to pass onSuccess/onError directly to render
|
94
|
+
s = Shrimple.new
|
95
|
+
s.merge!('executable' => nil, renderer: nil) # can't pass to constructor since nil means use default
|
96
|
+
expect(s.get_full_options(onSuccess: 4, onError: 5)).to eq({'onSuccess' => 4, 'onError' => 5}.merge(custom_headers))
|
97
|
+
end
|
98
|
+
|
92
99
|
it "has a working compact" do
|
93
100
|
expect(Shrimple.compact!({
|
94
101
|
a: nil,
|