2012-02-29 71 views

回答

1

我发现答案由我自己......(我是打猎回答这个2小时..发现这个刚刚发布此之后)

在David赫利姆斯基的网站,在文章“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 

这与我的情况下工作。

请注意,此参数化记录为黄瓜功能,所以我可以找到RSPec::Core document at Relish,但不在类文档中。