summaryrefslogtreecommitdiff
path: root/lib/minitest/spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/minitest/spec.rb')
-rw-r--r--lib/minitest/spec.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
index a70bbdd405..c6b6777acf 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -192,10 +192,12 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
# write specs don't like class inheritence, so this goes way out of
# its way to make sure that expectations aren't inherited.
#
+ # This is also aliased to #specify and doesn't require a +desc+ arg.
+ #
# Hint: If you _do_ want inheritence, use minitest/unit. You can mix
# and match between assertions and expectations as much as you want.
- def self.it desc, &block
+ def self.it desc = "anonymous", &block
block ||= proc { skip "(no tests defined)" }
@specs ||= 0
@@ -240,7 +242,9 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
# :stopdoc:
class << self
- attr_reader :name, :desc
+ attr_reader :desc
+ alias :specify :it
+ alias :name :to_s
end
# :startdoc:
end
@@ -334,9 +338,13 @@ module MiniTest::Expectations
#
# n.must_be :<=, 42
#
+ # This can also do predicates:
+ #
+ # str.must_be :empty?
+ #
# :method: must_be
- infect_an_assertion :assert_operator, :must_be
+ infect_an_assertion :assert_operator, :must_be, :reverse
##
# See MiniTest::Assertions#assert_output
@@ -491,9 +499,13 @@ module MiniTest::Expectations
#
# n.wont_be :<=, 42
#
+ # This can also do predicates:
+ #
+ # str.wont_be :empty?
+ #
# :method: wont_be
- infect_an_assertion :refute_operator, :wont_be
+ infect_an_assertion :refute_operator, :wont_be, :reverse
##
# See MiniTest::Assertions#refute_respond_to