lib/henry/task/cucumber_task.rb in henry-container-0.1.75 vs lib/henry/task/cucumber_task.rb in henry-container-0.1.76

- old
+ new

@@ -77,11 +77,11 @@ # Returns the custom cucumber_opts that user may have passed. # # @param [Hash] extended_options set of extended options. # @return [String] def custom_options(extended_options={}) - "#{self.format_options} #{self.tags_options(extended_options)} #{self.report_options} #{self.rerun_options} #{self.misc_options}" + "#{self.format_options} #{self.tags_options(extended_options)} #{self.report_options(extended_options)} #{self.rerun_options} #{self.misc_options}" end # Returns the miscellaneous cucumber_opts. # # @return [String] @@ -121,20 +121,20 @@ end # Returns the cucumber_opts related with report paaths and formats. # # @return [String] - def report_options + def report_options(extended_options={}) self.generated_reports = [] self.report_recipients = [] return '' if self.data.reports.nil? self.data.reports.collect do |report_options| report_options['name'] ||= "${DATE}_${TASK_NAME}.#{report_options['format']}" - self.generated_reports << self.report_file_path(report_options['format'], report_options['name']) + self.generated_reports << self.report_file_path(report_options['format'], report_options['name'], extended_options) self.report_recipients += (report_options['recipients'] || []) FileUtils.mkdir_p(self.reports_dir(report_options['format'])) "--format #{report_options['format']} --out #{self.report_file_path(report_options['format'], report_options['name'])}" @@ -164,19 +164,19 @@ # Returns the report file path for the given format and file name. # # @param [String] format the rspec formatter name. # @param [String] file_name the report file name template. # @return [String] the report file path. - def report_file_path(format, file_name) - "#{self.reports_dir(format)}/#{self.report_file_name(file_name)}" + def report_file_path(format, file_name, extended_options={}) + "#{self.reports_dir(format)}/#{self.report_file_name(file_name,extended_options)}" end # Interpolates and returns the report file name. # # @param [String] file_name the report file name. # @returns [String] the report file name. - def report_file_name(file_name) - file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT)).gsub(' ', '_') + def report_file_name(file_name,extended_options={}) + file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT), '${TAGS}' => ((self.data.options['tags']||[])+(extended_options['tags']||[])).join(' ')).gsub(' ', '_') end # Interpolates and returns the reports directory for the given format. # # @param [String] format the formatter name.