Class: Frameworks::RSpec

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/soundcheck/frameworks/rspec.rb

Instance Method Summary collapse

Methods included from Base

#filter_with, #to_s

Instance Method Details

#command(*args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# 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_argsObject



17
18
19
# File 'lib/soundcheck/frameworks/rspec.rb', line 17

def default_args
  ["spec"]
end

#filter(*args) ⇒ Object



9
10
11
12
13
14
15
# 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?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/soundcheck/frameworks/rspec.rb', line 5

def present?
  project.has_file?("spec")
end