Sha256: 0a34c0f43991ef6b57224589e21c9bb89e033ee3cb058180d14dafbb49fd2c64

Contents?: true

Size: 1.56 KB

Versions: 15

Compression:

Stored size: 1.56 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'resque/pool/cli_patches'

RSpec.describe Resque::Pool::CLI do
  after :all do
    Resque::Cluster.config = nil
    Resque::Cluster.member = nil
  end

  context "#run" do
    before :each do
      Resque::Cluster.config = nil
      Resque::Cluster.member = nil
    end

    it "sets up to run resque-pool the standard way if no params are passed in" do
      stub_const("ARGV", [])
      allow(Resque::Pool::CLI).to receive(:start_pool).and_return({ })
      Resque::Pool::CLI.run
      expect(Resque::Cluster.config).to be_nil
    end

    it "sets up to run resque-pool the standard way if no cluster params are passed in" do
      stub_const("ARGV", ["-c", "spec/local_config.yml", "-E", "test", "-G", "spec/global_config.yml"])
      allow(Resque::Pool::CLI).to receive(:start_pool).and_return({ })
      Resque::Pool::CLI.run
      expect(Resque::Cluster.config).to be_nil
      expect(ENV["RESQUE_POOL_CONFIG"]).to eq("spec/local_config.yml")
      expect(ENV["RESQUE_ENV"]).to eq("test")
    end

    it "sets up to run resque-pool the cluster way if cluster param is passed in" do
      stub_const("ARGV", ["-c", "spec/local_config.yml", "-E", "test", "-C", "test-cluster", "-G", "spec/global_config.yml"])
      allow(Resque::Pool::CLI).to receive(:start_pool).and_return({ })
      Resque::Pool::CLI.run
      expect(Resque::Cluster.config[:cluster_name]).to eq("test-cluster")
      expect(ENV["RESQUE_POOL_CONFIG"]).to eq("spec/local_config.yml")
      expect(ENV["RESQUE_ENV"]).to eq("test")
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
resque-cluster-0.1.1.1 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.2.5 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.2.4 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.2.3 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.2.2 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.2.1 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.2.0 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.1.1 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.1.0 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.0.7 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.0.6 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.0.4 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.0.3 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.0.2 spec/unit/resque_pool_cli_patches_spec.rb
resque-cluster-0.0.1 spec/unit/resque_pool_cli_patches_spec.rb