macournoyer/thin — Issue #76: [patch] commint 55c024c2 breaks unittests
Author: voxik
Created: 2011-11-29 14:49:12+00:00
State: open

Hello,

the 55c024c2 commit breaks unittests on some platforms

```
Failures:
1) Thin::Controllers::Service should create /etc/init.d/thin file when calling install
Failure/Error: File.read(Service::INITD_PATH).should include('CONFIG_PATH=tmp/sandbox/etc/thin',
expected "#!/bin/sh\n### BEGIN INIT INFO\n# Provides: thin\n# Required-Start: $local_fs $remote_fs\n# Required-Stop: $local_fs $remote_fs\n# Default-Start: 2 3 4 5\n# Default-Stop: S 0 1 6\n# Short-Description: thin initscript\n# Description: thin\n### END INIT INFO\n\n# Original author: Forrest Robertson\n\n# Do NOT \"set -e\"\n\nDAEMON=thin\nSCRIPT_NAME=tmp/sandbox/etc/rc.d/thin\nCONFIG_PATH=tmp/sandbox/etc/thin\n\n# Exit if the package is not installed\n[ -x \"$DAEMON\" ] || exit 0\n\ncase \"$1\" in\n start)\n\t$DAEMON start --all $CONFIG_PATH\n\t;;\n stop)\n\t$DAEMON stop --all $CONFIG_PATH\n\t;;\n restart)\n\t$DAEMON restart --all $CONFIG_PATH\n\t;;\n *)\n\techo \"Usage: $SCRIPT_NAME {start|stop|restart}\" >&2\n\texit 3\n\t;;\nesac\n\n:\n" to include "CONFIG_PATH=tmp/sandbox/etc/thin", "SCRIPT_NAME=tmp/sandbox/etc/init.d/thin", and "DAEMON=thin"
Diff:

@@ -1,2 +1,40 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: thin
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: S 0 1 6
+# Short-Description: thin initscript
+# Description: thin
+### END INIT INFO
+
+# Original author: Forrest Robertson
+
+# Do NOT "set -e"
+
+DAEMON=thin
+SCRIPT_NAME=tmp/sandbox/etc/rc.d/thin
CONFIG_PATH=tmp/sandbox/etc/thin
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+case "$1" in
+ start)
+	$DAEMON start --all $CONFIG_PATH
+	;;
+ stop)
+	$DAEMON stop --all $CONFIG_PATH
+	;;
+ restart)
+	$DAEMON restart --all $CONFIG_PATH
+	;;
+ *)
+	echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
+	exit 3
+	;;
+esac
+
+:
# /usr/lib/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# /usr/lib/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/handler.rb:19:in `handle_matcher'
# /usr/lib/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
# /builddir/build/BUILD/rubygem-thin-1.3.1/usr/lib/ruby/gems/1.8/gems/thin-1.3.1/spec/controllers/service_spec.rb:30
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
# /usr/lib/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
```

The attached patch [1] fixes the issue.

[1] https://gist.github.com/1405043