2011-01-31 18 views
0

当我做rspec的规范我得到的测试这样的报告:如何自定义Rspec的文档格式

Course Group 
    Loged in 
    In the new course group form 
     Create a new Group course 
     Create a new Group course with complex name (FAILED - 1) 
     Create a new Group course with 3 subjects (FAILED - 2) 

1) Course Group Loged in In the new course group form Create a new Group course with complex name 
    Failure/Error: course_groupDB.courses.count.should == 1 
     expected: 1 
      got: 0 (using ==) 
    # ./spec/acceptance/course_group_spec.rb:40:in `block (4 levels) in <top (required)>' 

2) Course Group Loged in In the new course group form Create a new Group course with 3 subjects 
    Failure/Error: course_groupDB.courses.count.should == 3 
     expected: 3 
      got: 0 (using ==) 
    # ./spec/acceptance/course_group_spec.rb:54:in `block (4 levels) in <top (required)>' 

通知之末,上市失败时,名字是相当混乱,因为它混合了所有的上下文,描述和例子。

有没有一种方法可以像之前列出的一样显示它?

像这样:

1) Course Group 
    Loged in 
     In the new course group form 
      Create a new Group course with complex name 
       Failure/Error: course_groupDB.courses.count.should == 1 
         expected: 1 
          got: 0 (using ==) 
        # ./spec/acceptance/course_group_spec.rb:40:in `block (4 levels) in <top (required)>' 

    2) Course Group 
    Loged in 
     In the new course group form 
      Create a new Group course with 3 subjects 
       Failure/Error: course_groupDB.courses.count.should == 3 
          expected: 3 
           got: 0 (using ==) 
         # ./spec/acceptance/course_group_spec.rb:54:in `block (4 levels) in <top (required)>' 

回答