Sha256: 18fc7abe50f84c3ff0ed637c6d0c6c0a091dc3e709a9fdf3742da5c1bd74b41a

Contents?: true

Size: 1.56 KB

Versions: 42

Compression:

Stored size: 1.56 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
include Controllers

describe Service do
  before(:all) do
    silence_stream(STDERR) do
      Service::INITD_PATH          = 'tmp/sandbox' + Service::INITD_PATH
      Service::DEFAULT_CONFIG_PATH = 'tmp/sandbox' + Service::DEFAULT_CONFIG_PATH
    end
  end
  
  before do
    Thin.stub!(:linux?).and_return(true)
    FileUtils.mkdir_p 'tmp/sandbox'
        
    @service = Service.new(:all => 'spec/configs')
  end
  
  it "should call command for each config file" do
    Command.should_receive(:run).with(:start, :config => 'spec/configs/cluster.yml', :daemonize => true)
    Command.should_receive(:run).with(:start, :config => 'spec/configs/single.yml', :daemonize => true)
    
    @service.start
  end
  
  it "should create /etc/init.d/thin file when calling install" do
    @service.install
    
    File.exist?(Service::INITD_PATH).should be_true
    File.read(Service::INITD_PATH).should include('CONFIG_PATH=tmp/sandbox/etc/thin',
                                                  'SCRIPT_NAME=tmp/sandbox/etc/init.d/thin',
                                                  'DAEMON=' + Command.script)
  end
  
  it "should create /etc/thin dir when calling install" do
    @service.install
    
    File.directory?(Service::DEFAULT_CONFIG_PATH).should be_true
  end
  
  it "should include specified path in /etc/init.d/thin script" do
    @service.install('tmp/sandbox/usr/thin')
    
    File.read(Service::INITD_PATH).should include('CONFIG_PATH=tmp/sandbox/usr/thin')
  end
  
  after do
    FileUtils.rm_rf 'tmp/sandbox'
  end
end

Version data entries

42 entries across 42 versions & 6 rubygems

Version Path
grockit-thin-0.8.2 spec/controllers/service_spec.rb
macournoyer-thin-1.0.1 spec/controllers/service_spec.rb
macournoyer-thin-1.1.0 spec/controllers/service_spec.rb
michaelyta-thin-1.2.2 spec/controllers/service_spec.rb
thin-1.2.11 spec/controllers/service_spec.rb
thin-1.2.11-x86-mswin32 spec/controllers/service_spec.rb
thin-1.2.11-x86-mingw32 spec/controllers/service_spec.rb
thin-1.2.10 spec/controllers/service_spec.rb
thin-1.2.10-x86-mswin32 spec/controllers/service_spec.rb
thin-1.2.10-x86-mingw32 spec/controllers/service_spec.rb
thin-1.2.9 spec/controllers/service_spec.rb
thin-1.2.9-x86-mswin32 spec/controllers/service_spec.rb
thin-1.2.9-x86-mingw32 spec/controllers/service_spec.rb
thin-1.2.8 spec/controllers/service_spec.rb
thin-1.2.8-x86-mswin32 spec/controllers/service_spec.rb
thin-1.2.8-x86-mingw32 spec/controllers/service_spec.rb
steamcannon-thin-1.2.8 spec/controllers/service_spec.rb
thin-1.2.7 spec/controllers/service_spec.rb
thin-1.2.7-x86-mswin32 spec/controllers/service_spec.rb
thin-1.2.7-x86-mingw32 spec/controllers/service_spec.rb