0
calls.should == [3000, 3001, 3002]
0
- it 'should shellify command' do
0
- out = @cluster.send(:shellify, :start, :port => 3000, :daemonize => true, :log => 'hi.log', :pid => nil)
0
- out.should include('--port=3000', '--daemonize', '--log="hi.log"', 'thin start --')
0
- out.should_not include('--pid=')
0
- it 'should start on specified port' do
0
- @cluster.should_receive(:`) do |with|
0
- with.should include('thin start', '--daemonize', 'thin.3001.log', 'thin.3001.pid', '--port=3001')
0
- with.should_not include('--socket')
0
+ it 'should start on each port' do
0
+ Command.should_receive(:run).with(:start, options_for_port(3000))
0
+ Command.should_receive(:run).with(:start, options_for_port(3001))
0
+ Command.should_receive(:run).with(:start, options_for_port(3002))
0
- @cluster.start
_server 3001 0
- it 'should stop on specified port' do
0
- @cluster.should_receive(:`) do |with|
0
- with.should include('thin stop', '--daemonize', 'thin.3001.log', 'thin.3001.pid', '--port=3001')
0
- with.should_not include('--socket')
0
+ it 'should stop on each port' do
0
+ Command.should_receive(:run).with(:stop, options_for_port(3000))
0
+ Command.should_receive(:run).with(:stop, options_for_port(3001))
0
+ Command.should_receive(:run).with(:stop, options_for_port(3002))
0
- @cluster.stop
_server 30010
+ def options_for_port(port)
0
+ { :daemonize => true, :log => "thin.#{port}.log", :timeout => 10, :address => "0.0.0.0", :port => port, :pid => "thin.#{port}.pid", :chdir => "./spec/rails_app" }
0
describe Cluster, "with UNIX socket" do
0
calls.should == [0, 1, 2]
0
- it 'should start specified server' do
0
- @cluster.should_receive(:`) do |with|
0
- with.should include('thin start', '--daemonize', 'thin.1.log', 'thin.1.pid', '--socket="/tmp/thin.1.sock"')
0
- with.should_not include('--port', '--address')
0
+ it 'should start each server' do
0
+ Command.should_receive(:run).with(:start, options_for_socket(0))
0
+ Command.should_receive(:run).with(:start, options_for_socket(1))
0
+ Command.should_receive(:run).with(:start, options_for_socket(2))
0
- @cluster.start
_server 10
- it 'should stop specified server' do
0
- @cluster.should_receive(:`) do |with|
0
- with.should include('thin stop', '--daemonize', 'thin.1.log', 'thin.1.pid', '--socket="/tmp/thin.1.sock"')
0
- with.should_not include('--port', '--address')
0
+ it 'should stop each server' do
0
+ Command.should_receive(:run).with(:stop, options_for_socket(0))
0
+ Command.should_receive(:run).with(:stop, options_for_socket(1))
0
+ Command.should_receive(:run).with(:stop, options_for_socket(2))
0
- @cluster.stop
_server 10
+ def options_for_socket(number)
0
+ { :daemonize => true, :log => "thin.#{number}.log", :timeout => 10, :socket => "/tmp/thin.#{number}.sock", :pid => "thin.#{number}.pid", :chdir => "./spec/rails_app" }
0
describe Cluster, "controlling only one server" do
0
it "should start only specified server" do
0
- @cluster.should_receive(:`) do |with|
0
- with.should include('thin start', '--daemonize', 'thin.3001.log', 'thin.3001.pid', '--port=3001')
0
- with.should_not include('3000', '3002')
0
+ Command.should_receive(:run).with(:start, options_for_port(3001))
0
+ def options_for_port(port)
0
+ { :daemonize => true, :log => "thin.#{port}.log", :timeout => 10, :address => "0.0.0.0", :port => port, :pid => "thin.#{port}.pid", :chdir => "./spec/rails_app" }
Comments
No one has commented yet.