Skip to content

Instantly share code, notes, and snippets.

@skinandbones
Created September 9, 2009 22:46
Show Gist options
  • Select an option

  • Save skinandbones/184152 to your computer and use it in GitHub Desktop.

Select an option

Save skinandbones/184152 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'test/unit'
require 'shoulda'
class NestedMacrosTest < Test::Unit::TestCase
def self.named_context(name, &block)
context "named context #{name}" do
setup do
@foo = name
end
context '' do
yield
end
end
end
%w[ A B C ].each do |name|
named_context name do
should "set foo to the context name" do
assert_equal name, @foo
end
end
end
context "when nested inside a context" do
%w[ D E F ].each do |name|
named_context name do
should "set foo to the context name" do
assert_equal name, @foo
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment