Sha256: 640bd23eca2e1e0b6016ab0c3b182c895ef3cc4766916b9c273e9b27316ef26a

Contents?: true

Size: 1.22 KB

Versions: 46

Compression:

Stored size: 1.22 KB

Contents

require File.expand_path("../command", __FILE__)

module Decko
  module Commands
    class CucumberCommand < Command
      def initialize args
        require "decko"
        require "./config/environment"
        @decko_args, @cucumber_args = split_args args
        @opts = {}
        Parser.new(@opts).parse!(@decko_args)
      end

      def command
        @cmd ||=
          "#{env_args} #{@opts[:executer] || "bundle exec"} cucumber #{require_args} #{feature_args}"
      end

      private

      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

      def feature_args
        if @cucumber_args.empty?
          feature_paths.join(" ")
        else
          @cucumber_args.shelljoin
        end
      end

      def require_args
        "-r #{Decko.gem_root}/features " +
          feature_paths.map { |path| "-r #{path}" }.join(" ")
      end

      def feature_paths
        Card::Mod.dirs.map do |p|
          Dir.glob "#{p}/features"
        end.flatten
      end
    end
  end
end

require File.expand_path("../cucumber_command/parser", __FILE__)

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decko-0.6.2 lib/decko/commands/cucumber_command.rb
decko-0.6.1 lib/decko/commands/cucumber_command.rb
decko-0.6.0 lib/decko/commands/cucumber_command.rb
decko-0.5.3 lib/decko/commands/cucumber_command.rb
decko-0.5.2 lib/decko/commands/cucumber_command.rb
decko-0.5.1 lib/decko/commands/cucumber_command.rb
decko-0.5.0 lib/decko/commands/cucumber_command.rb
decko-0.4.1 lib/decko/commands/cucumber_command.rb
decko-0.4.0 lib/decko/commands/cucumber_command.rb
decko-0.3.13 lib/decko/commands/cucumber_command.rb
decko-0.3.12 lib/decko/commands/cucumber_command.rb
decko-0.3.11 lib/decko/commands/cucumber_command.rb
decko-0.3.10 lib/decko/commands/cucumber_command.rb
decko-0.3.9 lib/decko/commands/cucumber_command.rb
decko-0.3.8 lib/decko/commands/cucumber_command.rb
decko-0.3.7 lib/decko/commands/cucumber_command.rb
decko-0.3.6 lib/decko/commands/cucumber_command.rb
decko-0.3.5 lib/decko/commands/cucumber_command.rb
decko-0.3.4 lib/decko/commands/cucumber_command.rb
decko-0.3.3 lib/decko/commands/cucumber_command.rb