= private = protected
it_should_behave_like(*shared_example_groups)
Use this to pull in examples from shared example groups.
# File lib/spec/example/example_group_methods.rb, line 64 def it_should_behave_like(*shared_example_groups) shared_example_groups.each do |group| include_shared_example_group(group) end end
Use it together with share_examples_for like this:
share_examples_for "a shape" do it "should have a color" do # ... end it "should have a center point" do # ... end end describe "a circle" do it_should_behave_like "a shape" it "should be round" do # ... end end
it "should have a color" do @shape.color.should == :black end end describe "a circle" do before(:all) do @shape = Circle.new end it_should_behave_like "a shape" end