Sha256: 7dbd9c3416a72970ae3631da34b9e148ddf75bc222b66e0a3eb8422710c2236b

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe OrgConverge::Helpers do
  include OrgConverge::Helpers

  tests = []
  tests << { 
    :dir => '/vagrant@127.0.0.1#2222:/home/vagrant/',
    :expected_user => "vagrant",
    :expected_host => "127.0.0.1",
    :expected_port => 2222,
    :expected_remote_dir => "/home/vagrant/"
  }
  tests << { 
    :dir => '/vagrant@127.0.0.1:/home/vagrant/',
    :expected_user => "vagrant",
    :expected_host => "127.0.0.1",
    :expected_port => 22,
    :expected_remote_dir => '/home/vagrant/'
  }
  tests << { 
    :dir => '/vagrant@127.0.0.1:',
    :expected_user => "vagrant",
    :expected_host => "127.0.0.1",
    :expected_port => 22,
    :expected_remote_dir => ''
  }
  tests << { 
    :dir => '/127.0.0.1:',
    :expected_user => nil,
    :expected_host => "127.0.0.1",
    :expected_port => 22,
    :expected_remote_dir => ''
  }
  tests << { 
    :dir => '/var/lib/org/',
    :expected_user => nil,
    :expected_host => nil,
    :expected_port => nil,
    :expected_remote_dir => nil
  }
  tests << { 
    :dir => 'org/',
    :expected_user => nil,
    :expected_host => nil,
    :expected_port => nil,
    :expected_remote_dir => nil
  }
  tests.each do |t|
    it "should parse ':dir #{t[:dir]}'" do
      ssh = determine_ssh_params(t[:dir])
      ssh[:user].should == t[:expected_user]
      ssh[:host].should == t[:expected_host]
      ssh[:port].should == t[:expected_port]
      ssh[:remote_dir].should == t[:expected_remote_dir]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
org-converge-0.0.17 spec/helpers_spec.rb
org-converge-0.0.16 spec/helpers_spec.rb
org-converge-0.0.15 spec/helpers_spec.rb