Please sign in to comment.
Don't add `describe` to every object.
Instead, make it only available on: - The main object--so it can be used at the top level. - Modules--so example groups can be declared nested within modules, as is the common practice. Besides this, the only other place we need describe is from within example groups (so we can nest them), and this is taken care of by RSpec::Core::ExampleGroup.describe. I got the idea for this from a recent change in Sinatra that similarly limits the DSL to just the main object rather than all objects: sinatra/sinatra@46bdb7d
- Loading branch information...
Showing with 28 additions and 1 deletion.
|@@ -0,0 +1,17 @@|
|+main = self|
|+describe "The describe method" do|
|+ it 'is available on the main object' do|
|+ main.should respond_to(:describe)|
|+ it 'is available on modules (so example groups can be nested inside them)' do|
|+ Module.new.should respond_to(:describe)|
|+ it 'is not available on other types of objects' do|
|+ Object.new.should_not respond_to(:describe)|