spec/shrimple_spec.rb in shrimple-0.8.4 vs spec/shrimple_spec.rb in shrimple-0.8.6
- old
+ new
@@ -87,9 +87,16 @@
s.merge!(executable: 'symbol')
expect(s.get_full_options(executable: 'symbol')).to eq({'executable' => 'symbol'}.merge(custom_headers))
expect(Shrimple.compact!(s.to_hash)).to eq({'executable' => 'symbol'}.merge(custom_headers))
end
+ it "properly merges callbacks" do
+ # this is in response to a bug where it was impossible to pass onSuccess/onError directly to render
+ s = Shrimple.new
+ s.merge!('executable' => nil, renderer: nil) # can't pass to constructor since nil means use default
+ expect(s.get_full_options(onSuccess: 4, onError: 5)).to eq({'onSuccess' => 4, 'onError' => 5}.merge(custom_headers))
+ end
+
it "has a working compact" do
expect(Shrimple.compact!({
a: nil,
b: { c: nil },
d: { e: { f: "", g: 1 } },