Created
June 27, 2015 02:27
-
-
Save ntl/470004c48b5fc2422ec7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem "whatever" | |
# Load minitest and red-green | |
group :minitest do | |
gem "minitest" | |
gem "minitest-rg" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Put this in bin/run_tests.rb or something and chmod 755 it | |
# Load bundler | |
require "bundler/setup" | |
Bundler.require :default, :minitest | |
# Load your code | |
require_relative "../lib/my_gem.rb" | |
# Run minitest with ARGV | |
Dir["tests/**/*.rb"].each &method(:load) | |
Minitest.run ARGV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The key learning before this setup works is twofold:
Minitest.run
test/test_helper.rb
, notest/support/*
, etc. If you need sample data, stick it in a directory calledsample_data
and write a loader class for it. Bundle that loader class in with your library, it'll actually help people actually exercise your code.Writing test suites like this, with no fluff around them, helps the TDD process by forcing you to feel maximum pain when your objects are difficult to demonstrate via exercising simple examples.