我使用RSpec的2.99,並具有以下簡單的規範文件:爲什麼RSpec按照它們聲明的順序運行示例?
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相同,文檔似乎是錯誤的。 – Stefan 2014-10-30 13:19:44
您的更新僅適用於'rand'訂單。 – Stefan 2014-10-30 13:57:59
也許,並不完全錯誤,但不夠明確。 – 2014-10-30 13:58:48