lib/wagn/commands/cucumber_command.rb in wagn-1.20.1 vs lib/wagn/commands/cucumber_command.rb in wagn-1.20.2
- old
+ new
@@ -4,28 +4,35 @@
module Commands
class CucumberCommand < Command
def initialize args
require "wagn"
require "./config/environment"
- @args = args
+ @wagn_args, @cucumber_args = split_args args
+ @opts = {}
+ Parser.new(@opts).parse!(@wagn_args)
end
def command
@cmd ||=
"#{env_args} bundle exec cucumber #{require_args} #{feature_args}"
end
private
def env_args
- env_args = "RAILS_ROOT=."
- env_args << " COVERAGE=false" if @args.present?
+ env_args = @opts[:env].join " "
+ # turn coverage off if not all cukes run
+ env_args << " COVERAGE=false" if @cucumber_args.present?
env_args
end
def feature_args
- @args.empty? ? feature_paths.join(" ") : @args.shelljoin
+ if @cucumber_args.empty?
+ feature_paths.join(" ")
+ else
+ @cucumber_args.shelljoin
+ end
end
def require_args
"-r #{Wagn.gem_root}/features " +
feature_paths.map { |path| "-r #{path}" }.join(" ")
@@ -37,5 +44,7 @@
end.flatten
end
end
end
end
+
+require File.expand_path("../cucumber_command/parser", __FILE__)