-
-
Notifications
You must be signed in to change notification settings - Fork 753
Fix block support in example.duplicate_with #2298
Conversation
expect(example2.metadata[:custom_key]).to eq(:custom_value) | ||
expect(example2.metadata[:block]).to_not eq(nil) |
There was a problem hiding this comment.
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")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea. Updated.
^ failed on JRuby, seems unrelated. |
Update spec to verify block exists in cloned example
All tests passing. JRuby is flaky. |
Example.new(example_group, description.clone, | ||
new_metadata, new_metadata[:block]) | ||
new_metadata, metadata[:block]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, LGTM then
Thanks @bootstraponline |
Thanks! |
Fix block support in example.duplicate_with
[skip ci]
Fix #2297