Sha256: 95ea3b1ee2155af8753f5c8d89ca1b00e04b5730c487733d3f96ce3476352af2

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

Stored size: 922 Bytes

Contents

require 'spec_helper'

module RedisFailover
  describe CLI do
    describe '.parse' do
      it 'returns empty result for empty options' do
        CLI.parse({}).should == {}
      end

      it 'properly parses redis nodes' do
        opts = CLI.parse(['-n host1:1,host2:2,host3:3'])
        opts[:nodes].should == [
          {:host => 'host1', :port => '1'},
          {:host => 'host2', :port => '2'},
          {:host => 'host3', :port => '3'}
        ]
      end

      it 'properly parses a redis password' do
        opts = CLI.parse(['-n host:port', '-p redis_pass'])
        opts[:nodes].should == [{
          :host => 'host',
          :port => 'port',
          :password => 'redis_pass'
        }]
      end

      it 'properly parses max node failures' do
        opts = CLI.parse(['-n host:port', '-p redis_pass', '--max-failures', '1'])
        opts[:max_failures].should == 1
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redis_failover-0.5.4 spec/cli_spec.rb
redis_failover-0.5.3 spec/cli_spec.rb
redis_failover-0.5.2 spec/cli_spec.rb
redis_failover-0.5.1 spec/cli_spec.rb
redis_failover-0.5.0 spec/cli_spec.rb