Shoulda教程之一—基本的should语句

原文:http://thoughtbot.com/projects/shoulda/tutorial/should

Should 语句

Should语句是一种简洁,优雅,高可读性的方式创建测试。Should语句能轻松地创建测试方法,所以完全向后兼容一般的Test::Unit 用法

class QuoteTest < Test::Unit::TestCase
 def setup
  # 和一般的Test::Unit一样
 end
 
 def test_should_be_true
  assert true
 end
 
 should "为真" do
  assert true
 end
end

以上的代码片断创建了两个测试方法:”测试: 应该为真”和test_should_be_true。在这个级别,两个方法只有名字不同。一旦你学习有关Contexts的知识,就可以找到一些非常有用的技巧。

This entry was posted on 星期六, 05月 10th, 2008 at 3:06 pm and is filed under Agile, Ruby. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

没有评论

Be the first to comment on this entry.

Have your say

You must be logged in to post a comment.

Recent Posts:
  1. Blog已搬迁 - 2008-08-22
  2. a few interesting rails plugin - 2008-08-06
  3. Get Start Java Network App Dev - 2008-08-06
  4. 思考着Blog搬家 - 2008-07-28
  5. a bug in attachment_fu - 2008-07-28
  1. 我的梦想

    我的梦想是成为世界级的软件开发者。。。 联系我请mailto: chenk85 AT gmail.com 或者加我MSN: chenk85 AT live.cn
  2. 标签

  3.  

    05月 2008
    « Apr   Jun »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  4. 文章分类

  5. 存档页

  6. 评头论足

    • 功能