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.10.0 lib/decko/commands/rspec_command.rb
decko-0.9.6 lib/decko/commands/rspec_command.rb
decko-0.9.5 lib/decko/commands/rspec_command.rb
decko-0.9.4 lib/decko/commands/rspec_command.rb
decko-0.9.3 lib/decko/commands/rspec_command.rb
decko-0.9.2 lib/decko/commands/rspec_command.rb
decko-0.9.1 lib/decko/commands/rspec_command.rb
decko-0.9.0 lib/decko/commands/rspec_command.rb
decko-0.8.3 lib/decko/commands/rspec_command.rb
decko-0.8.2 lib/decko/commands/rspec_command.rb
decko-0.8.1 lib/decko/commands/rspec_command.rb
decko-0.8.0 lib/decko/commands/rspec_command.rb
decko-0.7.0 lib/decko/commands/rspec_command.rb
decko-0.7.0.pre lib/decko/commands/rspec_command.rb
decko-0.6.8 lib/decko/commands/rspec_command.rb
decko-0.6.7 lib/decko/commands/rspec_command.rb
decko-0.6.6 lib/decko/commands/rspec_command.rb
decko-0.6.5 lib/decko/commands/rspec_command.rb
decko-0.6.4 lib/decko/commands/rspec_command.rb
decko-0.6.3 lib/decko/commands/rspec_command.rb