【问题标题】:How to pass -f specdoc option through rake task如何通过 rake 任务传递 -f specdoc 选项
【发布时间】:2010-05-23 02:37:44
【问题描述】:

我正在使用 rails 2.3.5 .rake 规范工作正常。

这是来自规范 --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。

【问题讨论】:

    标签: ruby-on-rails rspec


    【解决方案1】:

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

    --colour
    --format documentation
    

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

    【讨论】:

      【解决方案2】:

      rake 规范将尊重 SPEC_OPTS 环境变量。

      rake spec SPEC_OPTS="--format specdoc"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-11-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-07-02
        • 2015-07-22
        相关资源
        最近更新 更多