Module: Adva::Tasks::Test::Cucumber

Included in:
All, Features
Defined in:
lib/adva/tasks/core.rb

Instance Method Summary collapse

Instance Method Details

#cucumber_argsObject


48
49
50
51
# File 'lib/adva/tasks/core.rb', line 48

def cucumber_args
  args = cucumber_options + cucumber_files
  args.flatten.compact
end

#cucumber_filesObject


53
54
55
56
57
# File 'lib/adva/tasks/core.rb', line 53

def cucumber_files
  paths = Adva.engines.map { |engine| engine.root.join('features/**/*.feature').to_s }
  paths = paths.select { |path| path.include?(pattern) } if pattern
  Dir["{#{paths.join(',')}}"].sort
end

#cucumber_optionsObject


63
64
65
66
67
68
69
# File 'lib/adva/tasks/core.rb', line 63

def cucumber_options
  # programatically find out supported Cucumber options seems close to impossible because it
  # immediately calls parse! on its options as soon they are defined.
  # see http://github.com/aslakhellesoy/cucumber/blob/master/lib/cucumber/cli/options.rb#L261
  options = self.options.reject { |name, value| name.include?('rebuild') }
  options.map { |name, value| ["--#{name}", value.is_a?(String) ? value : nil] }.flatten.compact
end

#cucumber_patternObject


59
60
61
# File 'lib/adva/tasks/core.rb', line 59

def cucumber_pattern
  self.respond_to?(:pattern) ? self.pattern : ''
end