Sha256: 753beb7e9f7faba9ac9ac8551fee8d70a6069070b978969c5bfdab697e78475b

Contents?: true

Size: 966 Bytes

Versions: 46

Compression:

Stored size: 966 Bytes

Contents

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

module Decko
  module Commands
    class RspecCommand < Command
      def initialize args
        require "rspec/core"
        require "decko/application"

        @decko_args, @rspec_args = split_args args
        @opts = {}
        Parser.new(@opts).parse!(@decko_args)
      end

      def command
        "#{env_args} #{@opts[:executer]} #{@opts[:rescue]}" \
          "rspec #{@rspec_args.shelljoin} #{@opts[:files]} "\
          "--exclude-pattern \"./card/vendor/**/*\""
      end

      private

      def env_args
        ["RAILS_ROOT=.", coverage].compact.join " "
      end

      def coverage
        # no coverage if rspec was started with file argument
        if (@opts[:files] || @rspec_args.present?) && !@opts[:simplecov]
          @opts[:simplecov] = "COVERAGE=false"
        end
        @opts[:simplecov]
      end
    end
  end
end

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

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decko-0.3.2 lib/decko/commands/rspec_command.rb
decko-0.3.1 lib/decko/commands/rspec_command.rb
decko-0.3.0 lib/decko/commands/rspec_command.rb
decko-0.2.2 lib/decko/commands/rspec_command.rb
decko-0.2.1 lib/decko/commands/rspec_command.rb
decko-0.2 lib/decko/commands/rspec_command.rb