Class: Cyrun::ResultDirectory
- Inherits:
-
Object
- Object
- Cyrun::ResultDirectory
- Defined in:
- lib/cyrun/result_directory.rb
Instance Attribute Summary collapse
-
#screenshots_pattern ⇒ Object
readonly
Returns the value of attribute screenshots_pattern.
-
#spec_tasks ⇒ Object
readonly
Returns the value of attribute spec_tasks.
-
#temp_directory ⇒ Object
readonly
Returns the value of attribute temp_directory.
Instance Method Summary collapse
-
#initialize(temp_directory, screenshots_pattern, spec_tasks) ⇒ ResultDirectory
constructor
A new instance of ResultDirectory.
- #read_result_files ⇒ Object
- #screenshots ⇒ Object
Constructor Details
#initialize(temp_directory, screenshots_pattern, spec_tasks) ⇒ ResultDirectory
Returns a new instance of ResultDirectory.
9 10 11 12 13 |
# File 'lib/cyrun/result_directory.rb', line 9 def initialize(temp_directory, screenshots_pattern, spec_tasks) @temp_directory = temp_directory @spec_tasks = spec_tasks @screenshots_pattern = screenshots_pattern end |
Instance Attribute Details
#screenshots_pattern ⇒ Object (readonly)
Returns the value of attribute screenshots_pattern.
7 8 9 |
# File 'lib/cyrun/result_directory.rb', line 7 def screenshots_pattern @screenshots_pattern end |
#spec_tasks ⇒ Object (readonly)
Returns the value of attribute spec_tasks.
7 8 9 |
# File 'lib/cyrun/result_directory.rb', line 7 def spec_tasks @spec_tasks end |
#temp_directory ⇒ Object (readonly)
Returns the value of attribute temp_directory.
7 8 9 |
# File 'lib/cyrun/result_directory.rb', line 7 def temp_directory @temp_directory end |
Instance Method Details
#read_result_files ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cyrun/result_directory.rb', line 15 def read_result_files absolute_filenames = Dir .glob('results-*.xml', base: temp_directory) .map { |filename| File.(filename, temp_directory) } results = absolute_filenames .map { |filename| read_result_file filename } .reject(&:nil?) spec_tasks.map do |task| find_result_for_task(results, task) || create_failed_spec_result(task) end end |
#screenshots ⇒ Object
29 30 31 32 33 |
# File 'lib/cyrun/result_directory.rb', line 29 def screenshots Dir .glob(screenshots_pattern, base: Dir.pwd) .map { |filename| File.(filename, Dir.pwd) } end |