Module: MiniSpecMetadata::DescribeWithMetadata
- Defined in:
- lib/minispec-metadata/describe_with_metadata.rb
Instance Method Summary collapse
- #describe(desc, *_args, &block) ⇒ Object
-
#description_metadata ⇒ Object
Top-level method so all subclasses can call super.
Instance Method Details
#describe(desc, *_args, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/minispec-metadata/describe_with_metadata.rb', line 4 def describe(desc, *_args, &block) args = _args.dup = case args.last when Hash args.pop when Symbol # We're changing Minitest behavior here. # If args.first is anything but a Symbol, use it as additional_description. # If it's a symbol, assume it is metadata. additional_description = args.shift unless args.first.is_a?(Symbol) args.each_with_object({}) do |arg, hash| hash[arg] = true end else {} end additional_description ||= args.first description_class = super(desc, additional_description, &block) description_class.send :define_method, :description_metadata do super().merge() end description_class.send :define_method, :spec_additional_description do additional_description end description_class end |
#description_metadata ⇒ Object
Top-level method so all subclasses can call super.
38 39 40 |
# File 'lib/minispec-metadata/describe_with_metadata.rb', line 38 def {} end |