Sha256: b6dc974ba05196cfc858e2f53134b22f3dce8a4f854b19951bc69f2a8ae344a1

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require 'rspec'
require File.expand_path(File.dirname(__FILE__) + "/../lib/sidekiq-bossman")

describe Sidekiq::Bossman do

  before do
    FileUtils.touch(File.dirname(__FILE__) + "/sidekiq_project/log/sidekiq.log")
    @sidekiq_bossman = Sidekiq::Bossman.new(File.expand_path(File.dirname(__FILE__) + "/sidekiq_project"),
                                            :require => "#{File.expand_path(File.dirname(__FILE__) + "/sidekiq_project")}/boot.rb",
                                            :environment => "test")
  end

  after do
    begin
      Process.kill("TERM", File.read(@sidekiq_bossman.pidfile).to_i)
    rescue
    end
  end

  context ".start" do

    it 'successfully starts the Sidekiq workers' do
      begin
        fork { @sidekiq_bossman.start_workers }
        sleep 2
      ensure
        File.exists?(@sidekiq_bossman.pidfile).should be_true
      end
    end

  end

  context ".stop" do

    it 'successfully stops the Sidekiq workers' do
      begin
        fork { @sidekiq_bossman.start_workers }
        sleep 2
        @sidekiq_bossman.stop_workers
      ensure
        File.exists?(@sidekiq_bossman.pidfile).should be_false
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sidekiq-bossman-0.4.0 spec/sidekiq_bossman_spec.rb
sidekiq-bossman-0.3.0 spec/sidekiq_bossman_spec.rb
sidekiq-bossman-0.2.1 spec/sidekiq_bossman_spec.rb
sidekiq-bossman-0.2.0 spec/sidekiq_bossman_spec.rb
sidekiq-bossman-0.1.0 spec/sidekiq_bossman_spec.rb