Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Fix block support in example.duplicate_with #2298

Merged
merged 1 commit into from
Jul 19, 2016
Merged

Fix block support in example.duplicate_with #2298

merged 1 commit into from
Jul 19, 2016

Conversation

bootstraponline
Copy link
Contributor

Fix #2297

expect(example2.metadata[:custom_key]).to eq(:custom_value)
expect(example2.metadata[:block]).to_not eq(nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just asserting it is not nil, it would be good to make a positive assertion. How about expect(&example.metadata[:block]).to raise_error("first")?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea. Updated.

@bootstraponline
Copy link
Contributor Author

bootstraponline commented Jul 19, 2016

features/command_line/bisect.feature:93

^ failed on JRuby, seems unrelated.

Update spec to verify block exists in cloned example
@bootstraponline
Copy link
Contributor Author

bootstraponline commented Jul 19, 2016

All tests passing. JRuby is flaky.

Example.new(example_group, description.clone,
new_metadata, new_metadata[:block])
new_metadata, metadata[:block])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to do metadata[:block].clone, as thats what new_metadata is, but somehow it's missing the block from its clone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's missing because of the code on lines 135-137 that deletes the reserved keys.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, I think it still makes sense to clone it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, blocks are immutable, so I'm not sure what cloning it does for us other than taking more memory and time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, LGTM then

@JonRowe JonRowe merged commit 6c99362 into rspec:master Jul 19, 2016
@JonRowe
Copy link
Member

JonRowe commented Jul 19, 2016

Thanks @bootstraponline

JonRowe added a commit that referenced this pull request Jul 19, 2016
@bootstraponline
Copy link
Contributor Author

Thanks!

@bootstraponline bootstraponline deleted the block_duplicate_with branch July 20, 2016 02:42
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
Fix block support in example.duplicate_with
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
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.

3 participants