Sha256: 42d333c6d365dca0e78e478667c45035bc236cd0a57d08f47498eab486abba62

Contents?: true

Size: 839 Bytes

Versions: 5

Compression:

Stored size: 839 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]}"
      end

      private

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

      def coverage
        # no coverage if rspec was started with file argument
        return unless @opts[:files] || @rspec_args.present?

        "COVERAGE=false"
      end
    end
  end
end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decko-0.11.4 lib/decko/commands/rspec_command.rb
decko-0.11.3 lib/decko/commands/rspec_command.rb
decko-0.11.2 lib/decko/commands/rspec_command.rb
decko-0.11.1 lib/decko/commands/rspec_command.rb
decko-0.11.0 lib/decko/commands/rspec_command.rb