Rake tasks for testing

This commit is contained in:
Martin Lensment 2014-06-25 11:36:53 +03:00
parent 7e04591ccf
commit 5972b8fd7c
4 changed files with 33 additions and 3 deletions

30
lib/tasks/test.rake Normal file
View file

@ -0,0 +1,30 @@
require 'rspec/core/rake_task'
require 'open3'
desc 'Run all specs against server'
task 'test' do
test_against_server { Rake::Task['spec'].invoke }
end
desc 'Run EPP specs against server'
task 'test:epp' do
test_against_server { Rake::Task['spec:epp'].invoke }
end
desc 'Run all but EPP specs'
RSpec::Core::RakeTask.new('test:other') do |t|
t.rspec_opts = "--tag ~epp"
end
Rake::Task[:default].prerequisites.clear
task default: :test
def test_against_server
stdin, stdout, stderr, wait_thr = Open3.popen3('unicorn -E test -p 8989')
pid = wait_thr.pid
begin
yield
ensure
`kill #{pid}`
end
end