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

Background.feature is always nil #84

Closed
brasmusson opened this issue Mar 29, 2015 · 6 comments
Closed

Background.feature is always nil #84

brasmusson opened this issue Mar 29, 2015 · 6 comments

Comments

@brasmusson
Copy link
Contributor

As @e2 noted (cucumber/gherkin#334), the ast class for Background has an attr_accessor for :feature, but since the #feature is never set on the background object, #feature is always nil. Therefore things like background.feature.name in for instance #before_background in formatter will not work.

@e2
Copy link

e2 commented Mar 29, 2015

Thanks!

@mattwynne
Copy link
Member

In general, we've tried to keep the AST in the core from having circular references. Parent nodes know about their children, but not the other way around.

I think the right fix here is to make a change in or around https://github.com/cucumber/cucumber/blob/master/lib/cucumber/formatter/legacy_api/adapter.rb so that the background object passed to the formatter still has that old API, but we don't need to let that leak into the core's AST.

WDYT @tooky @brasmusson?

@brasmusson
Copy link
Contributor Author

I think avoiding circular references is the right thing to do, I only made the fix this way because the attr_accessor :feature declaration indicated the the intention was for backgrounds to know their feature.

@aslakhellesoy
Copy link
Contributor

@brasmusson @mattwynne whatever you do - please keep in mind cucumber-attic/gherkin#12

@brasmusson
Copy link
Contributor Author

Let's fix this in the Cucumber::Formatter::LegacyApi instead.

@lock
Copy link

lock bot commented Oct 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants