lib/helpers/throws.rb in activeset-0.7.1 vs lib/helpers/throws.rb in activeset-0.8.0
- old
+ new
@@ -9,11 +9,11 @@
# throws?(NoMethodError) { raise NameError }
# => false
# throws?(StandardError) { 'foo' }
# => false
-def throws?(exception) # &block
+def throws?(exception)
yield
false
-rescue Exception => e
+rescue StandardError => e
e.is_a? exception
end