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

Fix Configuration.with_options merge direction #922

Merged

Conversation

limhoff-r7
Copy link
Contributor

Without this change, factory.new(@configuration.with_options(out_stream: out_stream)) in Cucumber::Runtime#create_formatter doesn't actually changed the out_stream from STDOUT in the default configuration because the merge order was new_options.merge(@options), so any keys in both new_options and @options, like :out_stream, would have the value from @options win.

The specs weren't catching this problem because with_options was being called on Configuration.new, which had no keys set. I changed in spec in 63d4c37 to reveal the bug and fixed it in 067215c.

This bug may have manifested by users unable to override the --out from STDOUT when using new formatters that have initialize(configuration) instead of the legacy initialize/3

MSP-13453

Shows that with_options test only passed becasue out_stream hadn't been
set on the Configuration before calling with_options(out_stream:).
MSP-13453

Must be old.merge(new) so that new values for keys in both old and new
win.  Without this change,
`factory.new(@configuration.with_options(out_stream: out_stream))` in
Cucumber::Runtime#create_formatter doesn't actually changed the
out_stream from STDOUT in the default configuration.
@mattwynne
Copy link
Member

SUPERSLEUTH! 🔍

Thanks Luke, great work.

mattwynne added a commit that referenced this pull request Oct 13, 2015
…rection

Fix Configuration.with_options merge direction
@mattwynne mattwynne merged commit baa966b into cucumber:master Oct 13, 2015
@limhoff-r7 limhoff-r7 deleted the bug/MSP-13453/with-options-direction branch October 27, 2015 14:33
@lock
Copy link

lock bot commented Oct 25, 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 25, 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

Successfully merging this pull request may close these issues.

2 participants