【发布时间】:2014-04-17 12:25:39
【问题描述】:
shared_examples_for "test" do
specify { } # RSpec executes this line.
describe "nested" do
specify { } # RSpec doesn't execute this line.
describe "nested nested" do
specify { } # RSpec doesn't execute this line too.
end
end
end
为什么会这样? RSpec 甚至不识别嵌套行。 即使实际上有 3 个示例,它也仅显示“1 个示例”。 我使用的是 RSpec 2.14 版。
【问题讨论】:
-
如果您实际在其中放入内容和断言,它将运行它们。您还有一个语法错误 - 最后一个
do应该是end。 -
我放的代码只是一个框架,而不是实际的编码。
-
那么问题比你告诉我们的要多 - 正如答案所示,这会很好。
标签: ruby-on-rails rspec