Class: Spork::TestFramework::Assert

Inherits:
Spork::TestFramework
  • Object
show all
Defined in:
lib/spork/test_framework/assert.rb

Constant Summary collapse

DEFAULT_PORT =
8988
HELPER_FILE =
File.join(Dir.pwd, "test/test_helper.rb")

Instance Method Summary collapse

Instance Method Details

#require_tests(test_task) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/spork/test_framework/assert.rb', line 17

def require_tests(test_task)
  test_task ||= 'test'
  components = test_task.split ':'
  as_path = File.join(components)
  if File.directory? as_path
    Dir[File.join(components, '**', '*_test.rb')].each do |path|
      require path
    end
  else
    require "#{as_path}_test.rb"
  end
end

#run_tests(argv, stderr, stdout) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/spork/test_framework/assert.rb', line 6

def run_tests(argv, stderr, stdout)
  stdout.puts "[spork-assert] Loading tests matching '#{argv.first}' "
  require_tests argv.first

  stdout.puts '[spork-assert] Running tests'
  view = ::Assert::View::DefaultView.new(stdout)
  ::Assert.runner.new(::Assert.suite, view).run

  stdout.puts '[spork-assert] Done.'
end