如何参数化以在shared_example/include_examples之间传递信息?
在我的特定情况下,我想向shared_example提供几个常量。
发布于 2012-02-29 22:54:35
我自己找到了答案...(我花了两个小时寻找答案。在发布这篇文章后找到了这篇文章)
在David Chelimsky的站点上,在文章"Specifying mixins with shared example groups in RSpec-2“中,我发现shared_example可以接受块参数,而include_example可以提供参数。
shared_example "example_1" do |param|
it "does something" do
xx.should == param
end
end后来..。
include_examples "example_1", :value_1这对我的情况很有效。
请注意,此参数化记录为cucumber feature,因此我可以找到RSPec::Core document at Relish,但不能在类文档中找到它。
https://stackoverflow.com/questions/9494783
复制相似问题