Skip to content

Commit 760c9bd

Browse files
Forgot to add the Rakefile.
1 parent 1de5ab3 commit 760c9bd

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Rakefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ EOF
9999
})
100100
end
101101

102+
def self.require_package(name)
103+
begin
104+
require name
105+
rescue LoadError => e
106+
puts "You need the #{name} package. Try installing it with:\n"
107+
puts " $ gem install #{name}"
108+
exit
109+
end
110+
end
111+
102112
def self.syntax_highlighter
103113
if ENV['SYNTAX_HIGHLIGHTER']
104114
highlighter = ENV['SYNTAX_HIGHLIGHTER'].to_sym
@@ -347,6 +357,31 @@ task :clean_tmp do
347357
puts '"rake clean_tmp" is deprecated. Please use "rake test:clean" instead.'
348358
end
349359

360+
namespace :test_new do
361+
desc 'Starts the test server.'
362+
task :start => [:require] do
363+
path_to_app = File.join(PrototypeHelper::ROOT_DIR, 'test.new', 'server.rb')
364+
require path_to_app
365+
366+
puts "Unit tests available at <http://127.0.0.1:4567/test/>"
367+
UnitTests.run!
368+
end
369+
370+
task :require do
371+
PrototypeHelper.require_package('sinatra')
372+
end
373+
374+
desc "Opens the test suite in several different browsers. (Does not start or stop the server; you should do that separately.)"
375+
task :run => [:require] do
376+
browsers, tests, grep = ENV['BROWSERS'], ENV['TESTS'], ENV['GREP']
377+
path_to_runner = File.join(PrototypeHelper::ROOT_DIR, 'test.new', 'runner.rb')
378+
require path_to_runner
379+
380+
Runner::run(browsers, tests, grep)
381+
end
382+
383+
end
384+
350385
namespace :caja do
351386
task :test => ['test:build', 'test:run']
352387

0 commit comments

Comments
 (0)