Sha256: 1ec9cc71634038f4acf6735d5ad48e47ef96f75ad462dfa110c7974a75b14931
Contents?: true
Size: 393 Bytes
Versions: 9
Compression:
Stored size: 393 Bytes
Contents
# frozen_string_literal: true # Returns a Boolean for whether the block raises the Exception expected # # throws?(StandardError) { raise } # => true # throws?(NameError) { raise NameError } # => true # throws?(NoMethodError) { raise NameError } # => false # throws?(StandardError) { 'foo' } # => false def throws?(exception) yield false rescue StandardError => e e.is_a? exception end
Version data entries
9 entries across 9 versions & 2 rubygems