Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created November 28, 2010 15:54
Show Gist options
  • Save dchelimsky/719036 to your computer and use it in GitHub Desktop.
Save dchelimsky/719036 to your computer and use it in GitHub Desktop.
converting_shared_groups_from_rspec_1_to_rspec_2.rb
# using shared example groups for common setup. This is not really the intent of
# shared groups, but if you used them this way, here's what you need to do when
# upgrading to rspec-2
shared_examples_for "foo" do
before do
# do some setup
end
end
# rspec 1
describe "bar" do
it_should_behave_like "foo"
it "does something that needs setup from the shared group" do
# ...
end
end
# rspec 2
describe "bar" do
it_should_behave_like "foo" do
it "does something that needs setup from the shared group" do
# ...
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment