Method: RSpec::Core::Example#duplicate_with
- Defined in:
- lib/rspec/core/example.rb
permalink #duplicate_with(metadata_overrides = {}) ⇒ Example
Duplicates the example and overrides metadata with the provided hash.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/rspec/core/example.rb', line 132 def duplicate_with(={}) = .clone.merge() RSpec::Core::Metadata::RESERVED_KEYS.each do |reserved_key| .delete reserved_key end # don't clone the example group because the new example # must belong to the same example group (not a clone). # # block is nil in new_metadata so we have to get it from metadata. Example.new(example_group, description.clone, , [:block]) end |