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 7
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 15
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 27
def coverage
  "CARD_LOAD_STRATEGY=tmp_files" if @opts[:simplecov]
  # # no coverage if rspec was started with file argument
  # "CARD_SIMPLECOV=false" if @opts[:files] || @opts[:"no-simplecov"]
end
env_args() click to toggle source
# File lib/cardio/command/rspec_command.rb, line 23
def env_args
  ["RAILS_ROOT=.", coverage].compact.join " "
end