aboutsummaryrefslogtreecommitdiffstats
path: root/lib/minitest/spec.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-19 20:34:21 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-19 20:34:21 +0000
commit9bec8ef50ce1858ee2070a1637447eb12ce89990 (patch)
treee6cece58a34cf857c56e47bab13a5eeacd71af71 /lib/minitest/spec.rb
parent9cfc7a658f1e6f97fd88ee69310f4ccc5f20d73c (diff)
downloadruby-9bec8ef50ce1858ee2070a1637447eb12ce89990.tar.gz
Imported minitest 2.6.2 (r6712)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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