Created
October 3, 2011 21:50
-
-
Save hernan/1260357 to your computer and use it in GitHub Desktop.
keep the same shoulda syntax with minitest
This file contains hidden or 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
# | |
# 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