Sha256: 0706233842c577e8fd18053cbeae8e1b19c9b6ca26ee7fd33aa283bd1db85e58

Contents?: true

Size: 1.85 KB

Versions: 9

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'

describe Cany::Recipes::Sidekiq do
  let(:spec) do
    Cany::Specification.new do
      name 'test'
    end
  end
  let(:recipe) { spec.recipes.first }

  context '#binary' do
    context 'without configuration' do
      before do
        spec.setup do
          use :sidekiq
        end
      end

      it 'should launch sidekiq only with environment specification' do
        expect(recipe).to receive(:install_service).with(
          :sidekiq,
          %w(/usr/bin/test sidekiq --environment production),
          user: 'www-data', group: 'www-data'
        )
        recipe.inner = double('recipe')
        expect(recipe.inner).to receive(:binary)
        recipe.binary
      end
    end
  end

  context 'with queue names' do
    before do
      spec.setup do
        use :sidekiq do
          queue :name1
          queue :name2
        end
      end
    end

    it 'should launch sidekiq with the list of queues' do
      expect(recipe).to receive(:install_service).with(
        :sidekiq,
        %w(/usr/bin/test sidekiq --environment production --queue name1,name2),
        user: 'www-data', group: 'www-data'
      )
      recipe.inner = double('recipe')
      expect(recipe.inner).to receive(:binary)
      recipe.binary
    end
  end

  context 'with defined user/group' do
    before do
      spec.setup do
        use :sidekiq do
          user 'user'
          group 'group'
        end
      end
    end

    it 'should launch sidekiq with as this user and group' do
      expect(recipe).to receive(:install_service).with(
                            :sidekiq,
                            %w(/usr/bin/test sidekiq --environment production),
                            user: 'user', group: 'group'
                        )
      recipe.inner = double('recipe')
      expect(recipe.inner).to receive(:binary)
      recipe.binary
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cany-0.5.4 spec/cany/recipes/sidekiq_spec.rb
cany-0.5.3 spec/cany/recipes/sidekiq_spec.rb
cany-0.5.2 spec/cany/recipes/sidekiq_spec.rb
cany-0.5.1 spec/cany/recipes/sidekiq_spec.rb
cany-0.5.0 spec/cany/recipes/sidekiq_spec.rb
cany-0.4.0 spec/cany/recipes/sidekiq_spec.rb
cany-0.3.0 spec/cany/recipes/sidekiq_spec.rb
cany-0.2.1 spec/cany/recipes/sidekiq_spec.rb
cany-0.2.0 spec/cany/recipes/sidekiq_spec.rb