diff options
-rw-r--r-- | lib/bacon.rb | 2 | ||||
-rw-r--r-- | test/spec_bacon.rb | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index fd0f9ba..72342a3 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -232,7 +232,7 @@ end module Kernel private - def describe(name, &block) Bacon::Context.new(name.to_s, &block) end + def describe(*args, &block) Bacon::Context.new(args.join(' '), &block) end def shared(name, &block) Bacon::Shared[name] = block end end diff --git a/test/spec_bacon.rb b/test/spec_bacon.rb index b0cb510..0d8aefa 100644 --- a/test/spec_bacon.rb +++ b/test/spec_bacon.rb @@ -308,3 +308,32 @@ describe "shared/behaves_like" do } behaves_like "another shared context" end + +describe 'describe arguments' do + + def check(ctx,name) + ctx.should.be.an.instance_of Bacon::Context + ctx.instance_variable_get('@name').should == name + end + + it 'should work with string' do + check(describe( 'string') {},'string') + end + + it 'should work with symbols' do + check(describe( :behaviour) {},'behaviour') + end + + it 'should work with modules' do + check(describe( Bacon) {},'Bacon') + end + + it 'should work with namespaced modules' do + check(describe( Bacon::Context) {},'Bacon::Context') + end + + it 'should work with multiple arguments' do + check(describe( Bacon::Context, :empty) {},'Bacon::Context empty') + end + +end |