1

是否有任何现有的工具或命令可以自动列出应用程序中的每个示例?

例如,如果我有...

/spec/apple_spec.rb:

describe Apple do
  it "should be round" do
    @apple.shape.should == "round"
  end
  it "should be red" do
    @apple.colour.should == "red"
  do
end

/spec/banana_spec.rb:

describe Banana do
  it "should be bent" do
    @banana.shape.should == "bent"
  end
  it "should be yellow" do
    @banana.colour.should == "yellow"
  end
end

...然后我正在寻找的工具或命令会产生类似的东西:

apple_spec.rb
  - describe apple
    - it should be round
    - it should be red
banana_spec.rb
  - describe banana
    - it should be bent
    - it should be yellow

查看此输出将帮助我确认我已经测试了所有对我很重要的行为。

4

1 回答 1

0

设置format=documentation将为所有示例生成格式良好的输出,通过和失败。您可以在命令行上执行此操作:

rspec --format=documentation

或者将设置添加到.rspec项目根目录中的配置文件中。

于 2012-12-06T23:33:08.103 回答