method
it_should_behave_like
1.1.12 -
Show latest stable
- Class:
Spec::Example::ExampleGroupMethods
it_should_behave_like(*shared_example_groups)public
2Notes
Shared examples
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
Reusing shared examples
==== share_examples_for "a shape" do 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