Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

delay evaluation of full_description (don't always need it)

  • Loading branch information...
commit 87354eb0d3422bb5f627885f8961e52d09f796f4 1 parent 0896edf
@dchelimsky dchelimsky authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/rspec/core/metadata.rb
View
13 lib/rspec/core/metadata.rb
@@ -60,6 +60,7 @@ def process(*args)
user_metadata = args.last.is_a?(Hash) ? args.pop : {}
ensure_valid_keys(user_metadata)
+ self[:example_group].store(:description_args, args)
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))
@@ -95,10 +96,18 @@ def for_example(description, user_metadata)
dup.extend(LocationKeys).configure_for_example(description, user_metadata)
end
+ def [](key)
+ return super if has_key?(key)
+ case key
+ when :execution_result
+ store(:execution_result, {})
+ when :full_description
+ store(:full_description, full_description_from(self[:example_group][:full_description], self[:description]))
+ end
+ end
+
def configure_for_example(description, user_metadata)
store(:description, description.to_s)
- store(:full_description, "#{self[:example_group][:full_description]} #{self[:description]}")
- store(:execution_result, {})
store(:caller, user_metadata.delete(:caller) || caller)
update(user_metadata)
end
Please sign in to comment.
Something went wrong with that request. Please try again.