aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/process/set_proctitle_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/process/set_proctitle_spec.rb')
-rw-r--r--spec/ruby/core/process/set_proctitle_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/ruby/core/process/set_proctitle_spec.rb b/spec/ruby/core/process/set_proctitle_spec.rb
new file mode 100644
index 0000000000..e004f8efc9
--- /dev/null
+++ b/spec/ruby/core/process/set_proctitle_spec.rb
@@ -0,0 +1,23 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+# Note that there's no way to get the current process title defined as a spec
+# somewhere. Process.setproctitle explicitly does not change `$0` so the only
+# way to get the process title is to shell out.
+describe 'Process.setproctitle' do
+ platform_is :linux, :darwin do
+ before :each do
+ @old_title = $0
+ end
+
+ after :each do
+ Process.setproctitle(@old_title)
+ end
+
+ it 'should set the process title' do
+ title = 'rubyspec-proctitle-test'
+
+ Process.setproctitle(title).should == title
+ `ps -ocommand= -p#{$$}`.should include(title)
+ end
+ end
+end