Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created July 29, 2010 00:18
Show Gist options
  • Save dchelimsky/496834 to your computer and use it in GitHub Desktop.
Save dchelimsky/496834 to your computer and use it in GitHub Desktop.
module MyModule
SUBTESTS = %w[foo bar baz]
end
describe "#add_question_set_of_type" do
MyModule::SUBTESTS.each do |subtest|
describe %Q("#{subtest}") do
let(:subtest) { "#{subtest} in let" }
before { @subtest = "#{subtest} in before" }
it "does something" do
p subtest
p @subtest
end
end
end
end
$ spec example_spec.rb
"foo"
"foo in before"
."bar"
"bar in before"
."baz"
"baz in before"
.
Finished in 0.007255 seconds
3 examples, 0 failures
$ rspec example_spec.rb
"foo"
"foo in before"
."bar"
"bar in before"
."baz"
"baz in before"
.
Finished in 0.00126 seconds
3 examples, 0 failures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment