Skip to content

Instantly share code, notes, and snippets.

@hernan
Created October 3, 2011 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hernan/1260357 to your computer and use it in GitHub Desktop.
Save hernan/1260357 to your computer and use it in GitHub Desktop.
keep the same shoulda syntax with minitest
#
# https://github.com/padrino/padrino-framework/blob/master/padrino-core/test/mini_shoulda.rb
#
gem 'minitest'
require 'minitest/spec'
require 'minitest/autorun'
require 'mocha' # Load mocha after minitest
begin
require 'ruby-debug'
rescue LoadError; end
class MiniTest::Spec
class << self
alias :setup :before unless defined?(Rails)
alias :teardown :after unless defined?(Rails)
alias :should :it
alias :context :describe
def should_eventually(desc)
it("should eventually #{desc}") { skip("Should eventually #{desc}") }
end
end
alias :assert_no_match :refute_match
alias :assert_not_nil :refute_nil
alias :assert_not_equal :refute_equal
end
class ColoredIO
def initialize(io)
@io = io
end
def print(o)
case o
when "." then @io.send(:print, o.green)
when "E" then @io.send(:print, o.red)
when "F" then @io.send(:print, o.yellow)
when "S" then @io.send(:print, o.magenta)
else @io.send(:print, o)
end
end
def puts(*o)
super
end
end
MiniTest::Unit.output = ColoredIO.new(MiniTest::Unit.output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment