Skip to content

Instantly share code, notes, and snippets.

View hmistry's full-sized avatar

Hiren Mistry hmistry

View GitHub Profile
@hmistry
hmistry / ruby_gems_age.rb
Created August 17, 2019 22:47 — forked from borama/ruby_gems_age.rb
A script that collects and prints info about the age of all ruby gems in your project, see https://dev.to/borama/how-old-are-dependencies-in-your-ruby-project-3jia
#!/bin/env ruby
#
# Collects info about the age of all gems in the project
#
require "json"
require "date"
bundle = `bundle list`
yearly_stats = {}
@hmistry
hmistry / minitest_stub_raise_exception.md
Created October 31, 2017 02:28
Minitest stub to raise exception

Source: minitest/minitest#440 (comment)

kytrinyx commented on Jul 15, 2014 I would highly recommend separating out the two tests, and on the one hand asserting that your code handles the exception in the way you want it to, and on the other hand, that a collaborator calls the method that you expect it to call (without making assertions about what happens when it does).

Here's an example of the first type of test, using a stub:

class Cupcake
 class SpectacularError < RuntimeError; end