Skip to content

Commit

Permalink
allow additional description arguments to be passed to context()
Browse files Browse the repository at this point in the history
just like how RSpec allows: describe(SomeClass, "in some state")
  • Loading branch information
sunaku authored and djanowski committed Nov 19, 2009
1 parent 067f421 commit 4797a39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/contest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions test/all_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4797a39

Please sign in to comment.