Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Eh, let's try out minitest for a while

  • Loading branch information...
commit 765a6cda9c457fe2f908f5b5c000343ddaf555a9 1 parent e4dbfc0
@mcmire authored
Showing with 77 additions and 79 deletions.
  1. +2 −2 super_diff.gemspec
  2. +47 −49 test/differ_test.rb
  3. +28 −28 test/test_helper.rb
View
4 super_diff.gemspec
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
s.executables = Dir["bin/**/*"].map {|f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_development_dependency "ghi"
+ s.add_development_dependency "minitest"
s.add_development_dependency "differ"
- s.add_development_dependency "turn"
+ s.add_development_dependency "ghi"
end
View
96 test/differ_test.rb
@@ -1,53 +1,51 @@
require File.expand_path('../test_helper', __FILE__)
-module SuperDiff
- class DifferTest < TestCase
- def setup
- @differ = SuperDiff::Differ.new
- end
-
- def test_same_strings
- actual = @differ.diff("foo", "foo")
- expected = {
- :equal => true,
- :expected => {:value => "foo", :type => :string},
- :actual => {:value => "bar", :type => :string},
- :same_class => true
- }
- assert_equal expected, actual
- end
-
- def test_differing_strings
- actual = @differ.diff("foo", "bar")
- expected = {
- :equal => false,
- :expected => {:value => "foo", :type => :string},
- :actual => {:value => "bar", :type => :string},
- :same_class => true
- }
- assert_equal expected, actual
- end
-
- def test_differing_numbers
- actual = @differ.diff(1, 1)
- expected = {
- :equal => true,
- :expected => {:value => 1, :type => :number},
- :actual => {:value => 2, :type => :number},
- :same_class => true
- }
- assert_equal expected, actual
- end
-
- def test_differing_numbers
- actual = @differ.diff(1, 2)
- expected = {
- :equal => false,
- :expected => {:value => 1, :type => :number},
- :actual => {:value => 2, :type => :number},
- :same_class => true
- }
- assert_equal expected, actual
- end
+describe SuperDiff::Differ do
+ before do
+ @differ = SuperDiff::Differ.new
+ end
+
+ test "same strings" do
+ actual = @differ.diff("foo", "foo")
+ expected = {
+ :equal => true,
+ :expected => {:value => "foo", :type => :string},
+ :actual => {:value => "bar", :type => :string},
+ :same_class => true
+ }
+ actual.must_equal expected
+ end
+
+ test "differing strings" do
+ actual = @differ.diff("foo", "bar")
+ expected = {
+ :equal => false,
+ :expected => {:value => "foo", :type => :string},
+ :actual => {:value => "bar", :type => :string},
+ :same_class => true
+ }
+ actual.must_equal expected
+ end
+
+ test "differing numbers" do
+ actual = @differ.diff(1, 1)
+ expected = {
+ :equal => true,
+ :expected => {:value => 1, :type => :number},
+ :actual => {:value => 2, :type => :number},
+ :same_class => true
+ }
+ actual.must_equal expected
+ end
+
+ test "differing numbers" do
+ actual = @differ.diff(1, 2)
+ expected = {
+ :equal => false,
+ :expected => {:value => 1, :type => :number},
+ :actual => {:value => 2, :type => :number},
+ :same_class => true
+ }
+ actual.must_equal expected
end
end
View
56 test/test_helper.rb
@@ -1,36 +1,36 @@
-def rubygems_require(path)
- require path
-rescue LoadError => e
- require 'rubygems'
- require path
-end
+require 'rubygems'
-require 'test/unit'
+gem 'minitest'
+require 'minitest/autorun'
+require 'minitest/pride'
require 'stringio'
-rubygems_require 'turn'
-rubygems_require 'differ'
+require 'differ'
require File.expand_path("../../lib/super_diff", __FILE__)
-module SuperDiff
- class TestCase < Test::Unit::TestCase
- module Matchers
- # Override assert_equal to use Differ
- def assert_equal(expected, actual, message=nil)
- if String === expected && String === actual
- difference = Differ.diff_by_char(expected, actual)
- extra = "\n\nDifference:\n\n#{difference}"
- end
- full_message = message(message) { "Expected: <#{expected.inspect}>\n Got: <#{actual.inspect}>#{extra}" }
- assert(expected == actual, full_message)
- end
+#module SuperDiff
+# class TestCase < MiniTest::Unit::TestCase
+# module Matchers
+# # Override assert_equal to use Differ
+# def assert_equal(expected, actual, message=nil)
+# if String === expected && String === actual
+# difference = Differ.diff_by_char(expected, actual)
+# extra = "\n\nDifference:\n\n#{difference}"
+# end
+# full_message = message(message) { "Expected: <#{expected.inspect}>\n Got: <#{actual.inspect}>#{extra}" }
+# assert(expected == actual, full_message)
+# end
+#
+# def assert_empty(value, message="Expected value to be empty, but wasn't.")
+# assert value.empty?, message
+# end
+# end
+#
+# include Matchers
+# end
+#end
- def assert_empty(value, message="Expected value to be empty, but wasn't.")
- assert value.empty?, message
- end
- end
-
- include Matchers
- end
+class << MiniTest::Spec
+ alias_method :test, :it
end
Please sign in to comment.
Something went wrong with that request. Please try again.