Class: Spring::Commands::Test

Inherits:
Command
  • Object
show all
Defined in:
lib/spring/commands.rb

Instance Method Summary collapse

Methods inherited from Command

preloads, #preloads, preloads=

Instance Method Details

#call(args) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/spring/commands.rb', line 73

def call(args)
  if args.size > 0
    ARGV.replace args
    path = File.expand_path(args.first)

    if File.directory?(path)
      Dir[File.join path, "**", "*_test.rb"].each { |f| require f }
    else
      require path
    end
  else
    $stderr.puts "you need to specify what test to run: spring test TEST_NAME"
  end
end

#descriptionObject



88
89
90
# File 'lib/spring/commands.rb', line 88

def description
  "Execute a Test::Unit test."
end

#envObject



64
65
66
# File 'lib/spring/commands.rb', line 64

def env
  "test"
end

#setupObject



68
69
70
71
# File 'lib/spring/commands.rb', line 68

def setup
  $LOAD_PATH.unshift "test"
  super
end