fix up specs

This commit is contained in:
David Dollar committed 2012-01-22 21:17:54 -05:00
1 parent ce6ec4848d
commit 724812d6e3
1 file changed
+7 -5
+7 -5
View File
@@ -34,27 +34,27 @@ describe Foreman::Process do
end end
def run_file(executable, code) def run_file(executable, code)
file = File.open("#{basedir}/script.rb", 'w+') {|it| it << code } file = File.open("#{basedir}/script", 'w') {|it| it << code }
run "#{executable} #{file.path}" run "#{executable} #{file.path}"
end end
context 'options' do context 'options' do
it 'should set PORT for environment' do it 'should set PORT for environment' do
mock(subject).run_process(command, pipe) do mock(subject).run_process(basedir, command, pipe) do
ENV['PORT'].should == port.to_s ENV['PORT'].should == port.to_s
end end
run run
end end
it 'should set custom variables for environment' do it 'should set custom variables for environment' do
mock(subject).run_process(command, pipe) do mock(subject).run_process(basedir, command, pipe) do
ENV['foo'].should == 'bar' ENV['foo'].should == 'bar'
end end
run run
end end
it 'should restore environment afterwards' do it 'should restore environment afterwards' do
mock(subject).run_process command, pipe mock(subject).run_process(basedir, command, pipe)
run run
ENV.should_not include('PORT', 'foo') ENV.should_not include('PORT', 'foo')
end end
@@ -95,9 +95,11 @@ describe Foreman::Process do
it 'should send different signals' do it 'should send different signals' do
run_file 'ruby', <<-CODE run_file 'ruby', <<-CODE
trap 'TERM', 'IGNORE' trap "TERM", "IGNORE"
loop { sleep 1 } loop { sleep 1 }
CODE CODE
sleep 1 # wait for ruby to start
subject.should be_alive
subject.kill 'TERM' subject.kill 'TERM'
subject.should be_alive subject.should be_alive
subject.kill 'KILL' subject.kill 'KILL'