lib/henry/task/cucumber_task.rb in henry-container-0.0.60 vs lib/henry/task/cucumber_task.rb in henry-container-0.0.61
- old
+ new
@@ -13,10 +13,13 @@
OUT_PATH = 'cucumber.out'
# The reports path template.
REPORTS_DIR = '.henry/reports/${FORMAT}'
+ # Default time format to be used in the reports filepath.
+ TIME_FORMAT = '%Y-%m-%dT%H%M%S'
+
# Executes the CucumberTask and returns its results.
def execute
begin
Rake.application['cucumber'].invoke
@@ -88,11 +91,11 @@
# @return [String]
def tags_options
return '' if self.data.options['tags'].nil?
self.data.options['tags'].collect do |tag|
- "--tags @#{tag.split(',').join(',@')}"
+ "--tags #{tag.gsub(/(,?~?)(\w+)/, '\1@\2')}"
end.join(' ')
end
# Returns the cucumber_opts related with report paaths and formats.
#
@@ -138,10 +141,10 @@
# 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.to_s).gsub(' ', '_')
+ file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT)).gsub(' ', '_')
end
# Interpolates and returns the reports directory for the given format.
#
# @param [String] format the formatter name.