jnicklas/capybara — pull request #1113 by tgaff (2013-07-09 23:38:19+00:00)
Title: Permit nested features

In 2.1.0 using nested features such as:
````
feature 'big main feature' do
feature 'sub feature' do
scenario 'behaves well' do
.......
end
end
end
````
results in a NoMethodError

````
/Users/dev/devel/capybara/spec/rspec/features_spec.rb:38:in `block in ': undefined method `feature' for # (NoMethodError)
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/example_group.rb:245:in `module_eval'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/example_group.rb:245:in `subclass'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/example_group.rb:231:in `describe'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/dsl.rb:18:in `describe'
from /Users/dev/devel/capybara/lib/capybara/rspec/features.rb:22:in `feature'
from /Users/dev/devel/capybara/spec/rspec/features_spec.rb:8:in `'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/configuration.rb:896:in `load'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/configuration.rb:896:in `each'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/runner.rb:80:in `run'
from /Users/dev/.rvm/gems/ruby-1.9.3-p392@oceans/gems/rspec-core-2.14.1/lib/rspec/core/runner.rb:17:in `block in autorun'
````

This might not the most common use-case but rspec does permit nested `describe`s so capybara should probably behave similarly.

In the future if `self.feature` becomes more complex it might be better to move it to another module and then extend it instead.