【发布时间】:2014-10-30 12:39:59
【问题描述】:
我使用的是 RSpec 2.99,并且有以下简单的规范文件:
describe 'thing' do
context 'context' do
it 'one thing' do
# ...
end
it 'another thing' do
# ...
end
end
it 'without context' do
# ...
end
end
输出是:
$ bundle exec rspec test_spec.rb -fd
thing
without context
context
one thing
another thing
Finished in 0.00092 seconds
3 examples, 0 failures
我不明白为什么without context 会在之前 context。
这与--order 的文档中所写的内容相矛盾:
[...] 按照定义的顺序执行组和示例 [...]
我在这里错过了什么?
更新:在同一个文档页面上有一个概念:
嵌套组始终从顶层运行到底层 [...]
这是否适用于给定的情况?如果是这样,事实证明我无法让 RSpec 在规范文件中精确运行示例(抛开我为什么需要它的问题)。
【问题讨论】:
-
与 RSpec 3 相同,文档似乎有误。
-
您的更新仅适用于
rand订单。 -
也许,不是完全错误,而是不够清楚。
-
我认为你应该file a bug report。
-
你已经做到了! :-)