Class: Moto::Test::Metadata
- Inherits:
-
Object
- Object
- Moto::Test::Metadata
- Defined in:
- lib/test/metadata.rb
Overview
Provides tools for accessing metadata embedded in test files
Instance Attribute Summary collapse
-
#test_path ⇒ Object
readonly
Absolute test path.
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
Overriden eql? so various comparisons, array substractions etc.
-
#initialize(test_path) ⇒ Metadata
constructor
A new instance of Metadata.
-
#tags ⇒ Array
Of [String] which represent contents of #MOTO_TAGS.
-
#ticket_url ⇒ String
Which represents contents of #TICKET_URL.
Constructor Details
#initialize(test_path) ⇒ Metadata
Returns a new instance of Metadata.
10 11 12 |
# File 'lib/test/metadata.rb', line 10 def initialize(test_path) @test_path = test_path end |
Instance Attribute Details
#test_path ⇒ Object (readonly)
Absolute test path
7 8 9 |
# File 'lib/test/metadata.rb', line 7 def test_path @test_path end |
Instance Method Details
#eql?(other) ⇒ Boolean
Overriden eql? so various comparisons, array substractions etc. can be perfromed on Metadata objects with them being represented by test’s location
67 68 69 70 71 72 73 |
# File 'lib/test/metadata.rb', line 67 def eql?(other) if self.class == other.class return self.test_path == other.test_path end false end |
#tags ⇒ Array
Returns of [String] which represent contents of #MOTO_TAGS.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/test/metadata.rb', line 36 def if .nil? matches = text.match(/^#(\s*)MOTO_TAGS:(.*?)$/) if matches = matches.to_a[2].gsub(/\s*/, '').split(',') else = [] end end end |
#ticket_url ⇒ String
Returns which represents contents of #TICKET_URL.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/test/metadata.rb', line 51 def ticket_url if @ticket_url.nil? matches = text.match(/^#(\s*)TICKET_URL:(.*?)$/) if matches @ticket_url = matches.to_a[2].gsub(/\s*/, '') else @ticket_url = '' end end @ticket_url end |