Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

store instead of [key]=

  • Loading branch information...
commit d17dbec330e8d63c9e65b63bd58f75ae4554503e 1 parent a907d44
@dchelimsky dchelimsky authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 lib/rspec/core/metadata.rb
View
17 lib/rspec/core/metadata.rb
@@ -7,9 +7,11 @@ def [](key)
return super if has_key?(key)
case key
when :location
- self[key] = location
+ store(:location, location)
when :file_path, :line_number
- self[:file_path], self[:line_number] = file_and_line_number
+ file_path, line_number = file_and_line_number
+ store(:file_path, file_path)
+ store(:line_number, line_number)
self[key]
else
super
@@ -57,12 +59,11 @@ def process(*args)
user_metadata = args.last.is_a?(Hash) ? args.pop : {}
ensure_valid_keys(user_metadata)
- self[:example_group][:caller] = user_metadata.delete(:caller) || caller
- self[:example_group][:describes] = described_class_from(*args)
- self[:example_group][:description] = description_from(*args)
- self[:example_group][:full_description] = full_description_from(*args)
-
- self[:example_group][:block] = user_metadata.delete(:example_group_block)
+ self[:example_group].store(:caller, user_metadata.delete(:caller) || caller)
+ self[:example_group].store(:describes, described_class_from(*args))
+ self[:example_group].store(:description, description_from(*args))
+ self[:example_group].store(:full_description, full_description_from(*args))
+ self[:example_group].store(:block, user_metadata.delete(:example_group_block))
update(user_metadata)
end
Please sign in to comment.
Something went wrong with that request. Please try again.