Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit nested features #1113

Merged
merged 1 commit into from
Jul 10, 2013
Merged

Conversation

tgaff
Copy link
Contributor

@tgaff tgaff commented Jul 9, 2013

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 <top (required)>': undefined method `feature' for #<Class:0x007fb6c69049b0> (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 `<top (required)>'
    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 describes 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.

jnicklas added a commit that referenced this pull request Jul 10, 2013
@jnicklas jnicklas merged commit 61524b0 into teamcapybara:master Jul 10, 2013
@gaganawhad
Copy link

Curious: Any idea on when the next version of capybara might be available ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants