Sha256: 03715b5cbb69b46b52b6f6649cdd80189c0f3663759a12a31103a462b7d203d3
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
module RSpec module Core module SharedExampleGroup class Collection def initialize(sources, examples) @sources, @examples = sources, examples end def [](key) fetch_examples(key) || warn_deprecation_and_fetch_anyway(key) end private def fetch_examples(key) @examples[source_for key][key] end def source_for(key) @sources.reverse.find { |source| @examples[source].has_key? key } end def fetch_anyway(key) @examples.values.inject({}, &:merge)[key] end def warn_deprecation_and_fetch_anyway(key) if (example = fetch_anyway key) backtrace_line = CallerFilter.first_non_rspec_line RSpec.warn_deprecation <<-WARNING.gsub(/^ /, '') Accessing shared_examples defined across contexts is deprecated. Please declare shared_examples within a shared context, or at the top level. This message was generated at: #{backtrace_line} WARNING example end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems