Class: Frameworks::Minitest

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

Instance Method Summary collapse

Methods included from Base

#filter_with, #to_s

Instance Method Details

#command(*args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/soundcheck/frameworks/minitest.rb', line 17

def command(*args)
  # If we were given args, but none of them are minitest files, 
  # then we skip minitest
  return if not args.empty? and filter(*args).empty?
  args = filter(*args)

  # rake test can either run a single file, or all of them,
  # so if we're given more than one, just run all
  args = [] if args.length > 1
  args = args.map {|i| "TEST=#{i}" }

  to_run = []
  to_run << "bundle exec" if has_gemfile?
  to_run << "rake test"
  to_run << "-t" if options[:trace]
  to_run << args.join(" ")
  to_run.join(" ").strip
end

#filter(*args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/soundcheck/frameworks/minitest.rb', line 9

def filter(*args)
  filter_with(args, {
    :is_test_file   => /_test\.rb$/,
    :is_in_test_dir => /^test/,
    :is_dir         => lambda {|arg| project.has_dir?(arg) }
  })
end

#present?Boolean

Returns:

  • (Boolean)


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

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