Class: VerifiedDouble::ExampleMetadata
- Inherits:
-
Struct
- Object
- Struct
- VerifiedDouble::ExampleMetadata
- Defined in:
- lib/verified_double/example_metadata.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
Instance Method Summary collapse
- #described_class ⇒ Object
- #description ⇒ Object
- #method_signature_string ⇒ Object
- #verified_signature ⇒ Object
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata
2 3 4 |
# File 'lib/verified_double/example_metadata.rb', line 2 def @metadata end |
Instance Method Details
#described_class ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/verified_double/example_metadata.rb', line 3 def described_class if description.is_a?(Module) description elsif ![:example_group].nil? ExampleMetadata.new([:example_group]).described_class else raise StandardError, "The VerifiedDouble contract spec described class '#{description}' is invalid. The described class must be a class or a module." .gsub(/\s+/, ' ') end end |
#description ⇒ Object
16 17 18 |
# File 'lib/verified_double/example_metadata.rb', line 16 def description [:description_args][0] end |
#method_signature_string ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/verified_double/example_metadata.rb', line 20 def method_signature_string if description =~ /^[\.\#]/ description elsif [:example_group].nil? raise StandardError, "The VerifiedDouble contract spec method '#{description}' is invalid. The method must start with # or ." .gsub(/\s+/, ' ') else ExampleMetadata.new([:example_group]).method_signature_string end end |
#verified_signature ⇒ Object
33 34 35 |
# File 'lib/verified_double/example_metadata.rb', line 33 def verified_signature "#{described_class}#{method_signature_string}" end |