Sha256: 45ef38eda02d720b9a76aa5f742ba349235fe380d8a4b635d6b8e1bcdbe168bc

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'
require 'kangaroo/commands/base'

describe Kangaroo::Commands::Base do
  
  describe 'configuration, called with' do
    let(:argv) { [] }
    subject { described_class.new(*argv).configuration }
  
    context 'with --config file' do
      let(:argv) { %w(--config spec/test_env/test.yml) }
      
      its(['host']) { should == "127.0.0.1" }
      its(['database']) { should include('user' => 'admin')}
      its(['database']) { should include('password' => 'admin')}
      its(['database']) { should include('name' => 'kangaroo_test_database')}
      
      context 'and --host localhost' do
        let(:argv) { %w(--config spec/test_env/test.yml --host localhost) }
        its(['host']) { should == 'localhost'}
      end
    end
    
    context 'short arguments' do
      let(:argv) { %w(-u admin -p admin -d kangaroo_test_database) }
      its(['port']) { should == 8069 }
      its(['host']) { should == "localhost" }
      its(['database']) { should include('user' => 'admin')}
      its(['database']) { should include('password' => 'admin')}
      its(['database']) { should include('name' => 'kangaroo_test_database')}
    end
    
    context 'with --user, --password and --database' do
      let(:argv) { %w(--user admin --password admin --database kangaroo_test_database) }
      its(['port']) { should == 8069 }
      its(['host']) { should == "localhost" }
      its(['database']) { should include('user' => 'admin')}
      its(['database']) { should include('password' => 'admin')}
      its(['database']) { should include('name' => 'kangaroo_test_database')}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kangaroo-0.1.0.alpha1 spec/commands/base_spec.rb