Skip to content
Browse files

allow additional description arguments to be passed to context()

just like how RSpec allows: describe(SomeClass, "in some state")
  • Loading branch information...
1 parent 067f421 commit 4797a39a912f33bdebaa0db400f19440f0e07329 Suraj N. Kurapati committed with djanowski Aug 15, 2009
Showing with 8 additions and 2 deletions.
  1. +2 −2 lib/contest.rb
  2. +6 −0 test/all_test.rb
View
4 lib/contest.rb
@@ -30,11 +30,11 @@ def self.teardown(&block)
end
end
- def self.context(name, &block)
+ def self.context(*name, &block)
subclass = Class.new(self)
remove_tests(subclass)
subclass.class_eval(&block) if block_given?
- const_set(context_name(name), subclass)
+ const_set(context_name(name.join(" ")), subclass)
end
def self.test(name, &block)
View
6 test/all_test.rb
@@ -19,6 +19,12 @@ class FooTest < Test::Unit::TestCase
end
end
+ context "context", "with multiple", "arguments " do
+ should "run the test inside" do
+ assert_equal 1, @value
+ end
+ end
+
context "some context" do
setup do
@value += 1

0 comments on commit 4797a39

Please sign in to comment.
Something went wrong with that request. Please try again.