class Frameworks::RSpec

Public Instance Methods

command(*args) click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 21
def command(*args)
  args = (args.empty? ? default_args : filter(*args))
  return nil if args.empty?

  to_run = []
  to_run << executable
  to_run << "-b" if options[:trace]
  to_run << "--format=doc" if args.size < 2 and args != default_args
  to_run << args.join(" ")
  to_run.join(" ").strip
end
default_args() click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 17
def default_args
  ["spec"]
end
filter(*args) click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 9
def filter(*args)
  filter_with(args, {
    :is_spec_file   => /_spec\.rb$/,
    :is_in_spec_dir => /^spec/,
    :is_dir         => lambda {|arg| project.has_dir?(arg) }
  })
end
present?() click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 5
def present?
  project.has_file?("spec")
end

Private Instance Methods

executable() click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 35
def executable
  if has_binstub?
    "bin/rspec"
  elsif has_gemfile?
    "bundle exec rspec"
  else
    "rspec"
  end
end
has_binstub?() click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 45
def has_binstub?
  project.has_file?('bin/rspec')
end
has_gemfile?() click to toggle source
# File lib/soundcheck/frameworks/rspec.rb, line 49
def has_gemfile?
  project.has_file?("Gemfile")
end