Created
September 9, 2009 22:46
-
-
Save skinandbones/184152 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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