Sha256: 4f5ad003d61b5fbb7a1ec268502ac315fc0f24e0667b77bbb7acd6c7c3e0ad1b

Contents?: true

Size: 990 Bytes

Versions: 7

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'
require 'shinq/cli'

describe Shinq::CLI do
  after do
    Shinq.clear_all_connections!
  end

  describe '.new' do
    context 'when there are require statement' do
      it 'requires and run the code' do
        # NOTE: As CLI alters global process irreversibly, we only check the result
        Shinq::CLI.new(%W[
          --require my_worker
          --db-config #{File.expand_path('../config/database.yml', __dir__)}
          --worker my_worker
        ])
        expect(defined? MyWorker).to eq 'constant'
      end
    end
  end

  describe '#run' do
    before do
      allow_any_instance_of(ServerEngine::Daemon).to receive(:run).and_return(nil)
    end

    it 'launches Shinq::Launcher backended by ServerEngine' do
      expect {
        Shinq::CLI.new(%W[
          --require my_worker
          --db-config #{File.expand_path('../config/database.yml', __dir__)}
          --worker my_worker
        ]).run
      }.not_to raise_error
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shinq-1.3.0 spec/shinq/cli_spec.rb
shinq-1.2.0 spec/shinq/cli_spec.rb
shinq-1.1.0 spec/shinq/cli_spec.rb
shinq-1.0.2 spec/shinq/cli_spec.rb
shinq-1.0.1 spec/shinq/cli_spec.rb
shinq-1.0.0 spec/shinq/cli_spec.rb
shinq-1.0.0.rc1 spec/shinq/cli_spec.rb