shigeya
shigeya

Reputation: 4912

Parameterize shared example with rspec2

How I can parameterize to pass information between shared_example/include_examples?

In my specific case, I want to feed several constants to shared_example.

Upvotes: 1

Views: 183

Answers (1)

shigeya
shigeya

Reputation: 4912

I found answer by myself... (I was hunting for answer for this two hours.. found this just after posting this)

At David Chelimsky's site, in article "Specifying mixins with shared example groups in RSpec-2," I found that shared_example can accept block parameters, and include_example can give parameters..

shared_example "example_1" do |param|
  it "does something" do
    xx.should == param
  end   
end

and later...

include_examples "example_1", :value_1

This work well with my case.

Note that, this parametalization is documented as cucumber feature, so I could find RSPec::Core document at Relish, but not in the class documentation.

Upvotes: 1

Related Questions