Commit 1e4c4ef3 authored by Florian R. Hanke's avatar Florian R. Hanke

[Executable] Also test indentation.

parent 02d4aaa7
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
result = mock result = mock
result.stubs(:success?).returns(true) result.stubs(:success?).returns(true)
Open3.expects(:popen3).with('/Spa ces/are"/fun/false').once.returns(result) PTY.expects(:spawn).with('/Spa ces/are"/fun/false').once.returns(result)
Executable.execute_command(cmd, [], true) Executable.execute_command(cmd, [], true)
end end
...@@ -24,10 +24,33 @@ module Pod ...@@ -24,10 +24,33 @@ module Pod
cmd = ['-e', <<-RB] cmd = ['-e', <<-RB]
Process.fork { Process.daemon(nil, true); sleep(4) } Process.fork { Process.daemon(nil, true); sleep(4) }
puts 'out' puts 'out'
warn 'err'
RB RB
Timeout.timeout(2) do Timeout.timeout(2) do
Executable.execute_command('ruby', cmd, true).should == "out\n" Executable.execute_command('ruby', cmd, true).should == "out\r\nerr\r\n"
end end
end end
it "captures all output by the subprocess" do
cmd = ['-e', <<-RB]
puts 'out'
warn 'err'
p 'p'
print 'print'
RB
Executable.execute_command('ruby', cmd, true).should == "out\r\nerr\r\n\"p\"\r\nprint"
end
it "indents output correctly" do
cmd = ['-e', <<-RB]
puts 'out'
warn 'err'
RB
UI.indentation_level = 4
Executable.execute_command('ruby', cmd, true).should == " out\r\n err\r\n"
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment