This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,10 @@ def duplicate_with(metadata_overrides={})
138
138
139
139
# don't clone the example group because the new example
140
140
# must belong to the same example group (not a clone).
141
+ #
142
+ # block is nil in new_metadata so we have to get it from metadata.
141
143
Example . new ( example_group , description . clone ,
142
- new_metadata , new_metadata [ :block ] )
144
+ new_metadata , metadata [ :block ] )
143
145
end
144
146
145
147
# @private
Original file line number Diff line number Diff line change @@ -84,13 +84,17 @@ def metadata_hash(*args)
84
84
85
85
describe '#duplicate_with' do
86
86
it 'successfully duplicates an example' do
87
- example = example_group . example { raise 'first' }
87
+ error_string = 'first'
88
+ example = example_group . example { raise error_string }
88
89
example2 = example . duplicate_with ( { :custom_key => :custom_value } )
89
90
90
91
# ensure metadata is unique for each example
91
92
expect ( example . metadata . object_id ) . to_not eq ( example2 . metadata . object_id )
92
93
expect ( example . metadata [ :custom_key ] ) . to eq ( nil )
94
+ expect ( &example . metadata [ :block ] ) . to raise_error ( error_string )
95
+
93
96
expect ( example2 . metadata [ :custom_key ] ) . to eq ( :custom_value )
97
+ expect ( &example2 . metadata [ :block ] ) . to raise_error ( error_string )
94
98
95
99
# cloned examples must have unique ids
96
100
expect ( example . id ) . to_not eq ( example2 . id )
You can’t perform that action at this time.
0 commit comments