Skip to content

Instantly share code, notes, and snippets.

@pariser
Created June 27, 2019 16:45
Show Gist options
  • Save pariser/db98723c0b480ae82eb5c946b19f23dc to your computer and use it in GitHub Desktop.
Save pariser/db98723c0b480ae82eb5c946b19f23dc to your computer and use it in GitHub Desktop.
sorbet rspec ignore doubles
T::Configuration.call_validation_error_handler = lambda do |signature, opts|
method_file, method_line = signature.method.source_location
location = opts[:location]
suffix = "Caller: #{location.path}:#{location.lineno}\n" \
"Definition: #{method_file}:#{method_line}"
error_message = "#{opts[:kind]}#{opts[:name] ? " '#{opts[:name]}'" : ''}: #{opts[:message]}\n#{suffix}"
break if opts[:value].is_a?(RSpec::Mocks::Double)
raise TypeError.new(error_message)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment