Sha256: f76dbe3184bc7acd6794e4f3bded13479b1048f9c2bd304f8a69dbb02b4c01a0
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
module Memoria module RSpec # Extracts information from RSpec's examples metadata. module MetadataParser extend self # Finds RSpec's description of a given example's metadata. # # @param [Hash] metadata RSpec's metadata of a given example. # # @return [String] # # @api private # def find_description_for(metadata) description = find_description_in(metadata) example_group = find_example_group_in(metadata) if example_group [find_description_for(example_group), description].join('/') else description end end private # Finds an RSpec description in a given metadata. # # @param [Hash] metadata RSpec's metadata # # @return [String] The description of an RSpec example # def find_description_in(metadata) metadata[:description].empty? ? metadata[:scoped_id] : metadata[:description] end # Finds an RSpec example group in a given metadata. # # @param [Hash] metadata RSpec's metadata # # @return [Hash] The metadata of an RSpec example group # def find_example_group_in(metadata) metadata.key?(:example_group) ? metadata[:example_group] : metadata[:parent_example_group] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
memoria-0.1.0 | lib/memoria/rspec/metadata_parser.rb |