Skip to content

Instantly share code, notes, and snippets.

View stefanozanella's full-sized avatar

Stefano Zanella stefanozanella

View GitHub Profile
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active December 10, 2022 13:34
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
@retr0h
retr0h / gist:2003252
Created March 8, 2012 20:29
nova ssl offloading
server {
listen 443 default_server ssl;
server_name api.example.com;
ssl_certificate /path/to.crt;
ssl_certificate_key /path/to.key;
access_log /var/log/nginx/example.com-ssl.log;
location / {
include /etc/nginx/proxy.conf;
proxy_pass http://localhost: 8774/;
}
@mitfik
mitfik / ruby_csr_example.rb
Created February 27, 2012 10:13
Ruby example of CSR with openssl
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)