2010-05-23 49 views
6

我正在使用rails 2.3.5 .rake spec工作正常。如何通过-f specdoc选项通过rake任务

这是来自spec --help。

spec --help 

-f, --format FORMAT[:WHERE]  Specifies what format to use for output. Specify WHERE to tell 
            the formatter where to write the output. All built-in formats 
            expect WHERE to be a file name, and will write to $stdout if it's 
            not specified. The --format option may be specified several times 
            if you want several outputs 

            Builtin formats: 
            silent|l     : No output 
            progress|p    : Text-based progress bar 
            profile|o    : Text-based progress bar with profiling of 10 slowest examples 
            specdoc|s    : Code example doc strings 
            nested|n     : Code example doc strings with nested groups indented 
            html|h     : A nice HTML report 
            failing_examples|e  : Write all failing examples - input for --example 

           failing_example_groups|g : Write all failing example groups - input for --example 

如何通过rake任务传递-f specdoc。

回答

8

添加或编辑.rspec文件到rails根目录。例如,我现在包含以下选项:

--colour 
--format documentation 

请注意,specdoc格式的新名称是RSpec 2.1中的文档。

7

rake spec将尊重SPEC_OPTS环境变量。

rake spec SPEC_OPTS="--format specdoc"