class Wagn::Commands::CucumberCommand

Public Class Methods

new(args) click to toggle source
# File lib/wagn/commands/cucumber_command.rb, line 6
def initialize args
  require "wagn"
  require "./config/environment"
  @wagn_args, @cucumber_args = split_args args
  @opts = {}
  Parser.new(@opts).parse!(@wagn_args)
end

Public Instance Methods

command() click to toggle source
# File lib/wagn/commands/cucumber_command.rb, line 14
def command
  @cmd ||=
    "#{env_args} bundle exec cucumber #{require_args} #{feature_args}"
end

Private Instance Methods

env_args() click to toggle source
# File lib/wagn/commands/cucumber_command.rb, line 21
def env_args
  env_args = @opts[:env].join " "
  # turn coverage off if not all cukes run
  env_args << " COVERAGE=false" if @cucumber_args.present?
  env_args << " RAILS_GROUPS=test,debug"
  env_args
end
feature_args() click to toggle source
# File lib/wagn/commands/cucumber_command.rb, line 29
def feature_args
  if @cucumber_args.empty?
    feature_paths.join(" ")
  else
    @cucumber_args.shelljoin
  end
end
feature_paths() click to toggle source
# File lib/wagn/commands/cucumber_command.rb, line 42
def feature_paths
  Card::Mod::Loader.mod_dirs.map do |p|
    Dir.glob "#{p}/features"
  end.flatten
end
require_args() click to toggle source
# File lib/wagn/commands/cucumber_command.rb, line 37
def require_args
  "-r #{Wagn.gem_root}/features " +
    feature_paths.map { |path| "-r #{path}" }.join(" ")
end