Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactor: rename superclass_metadata to parent_group_metadata

  • Loading branch information...
commit 0896edfaa944f6e46ed4cb18544544203772b7aa 1 parent da80d2e
@dchelimsky dchelimsky authored
Showing with 11 additions and 17 deletions.
  1. +11 −17 lib/rspec/core/metadata.rb
View
28 lib/rspec/core/metadata.rb
@@ -32,16 +32,17 @@ def first_caller_from_outside_rspec
end
end
- def initialize(superclass_metadata=nil)
- @superclass_metadata = superclass_metadata
- if @superclass_metadata
- update(@superclass_metadata)
- example_group = {:example_group => @superclass_metadata[:example_group]}
+ attr_reader :parent_group_metadata
+
+ def initialize(parent_group_metadata=nil)
+ if parent_group_metadata
+ @parent_group_metadata = parent_group_metadata
+ update(@parent_group_metadata)
+ store(:example_group, {:example_group => @parent_group_metadata[:example_group]}.extend(LocationKeys))
else
- example_group = {}
+ store(:example_group, {}.extend(LocationKeys))
end
- store(:example_group, example_group.extend(LocationKeys))
yield self if block_given?
end
@@ -165,10 +166,6 @@ def world
RSpec.world
end
- def superclass_metadata
- @superclass_metadata ||= { :example_group => {} }
- end
-
def description_from(*args)
args.inject("") do |result, a|
a = a.to_s.strip
@@ -183,16 +180,13 @@ def description_from(*args)
end
def full_description_from(*args)
- if superclass_metadata[:example_group][:full_description]
- description_from(superclass_metadata[:example_group][:full_description], *args)
- else
+ parent_group_metadata && description_from(parent_group_metadata[:example_group][:full_description], *args) ||
description_from(*args)
- end
end
def described_class_from(*args)
- superclass_metadata[:example_group][:describes] || begin
- args.first unless args.first.is_a?(String) || args.first.is_a?(Symbol)
+ parent_group_metadata && parent_group_metadata[:example_group][:describes] || begin
+ args.first unless String === args.first || Symbol === args.first
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.