class Cardio::Command::RspecCommand

enhance standard RSpec command with some decko/card -specific options

Public Class Methods

new(args) click to toggle source
# File lib/cardio/command/rspec_command.rb, line 8
def initialize args
  require "rspec/core"

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

Public Instance Methods

command() click to toggle source
# File lib/cardio/command/rspec_command.rb, line 16
def command
  "#{env_args} #{@opts[:executer]} #{@opts[:rescue]}" \
    "rspec #{@rspec_args.shelljoin} #{@opts[:files]}"
  # .tap { |c| puts c.yellow }
end

Private Instance Methods

coverage() click to toggle source
# File lib/cardio/command/rspec_command.rb, line 28
def coverage
  if @opts[:simplecov]
    "CARD_LOAD_STRATEGY=tmp_files"
  elsif @opts[:files]
    # explicitly no coverage if rs pec was started with file argument
    "CARD_SIMPLECOV=false"
  end
end
env_args() click to toggle source
# File lib/cardio/command/rspec_command.rb, line 24
def env_args
  ["RAILS_ROOT=.", coverage].compact.join " "
end