Sha256: 6ae06e71ab055b41e55f1676a4d81f5cf598297cfa4e468854f820690b2eb68c
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' describe Dbcp::SshExecutionHost do subject { Dbcp::SshExecutionHost.new_from_uri 'ssh://staging_user@staging.example.com:2222/www/staging/current' } describe ".new_from_uri" do context "with valid uri" do specify do host = Dbcp::SshExecutionHost.new_from_uri 'ssh://staging_user@staging.example.com:2222/www/staging/current' expect(host).to be_a Dbcp::SshExecutionHost expect(host.host).to eq 'staging.example.com' expect(host.port).to eq 2222 expect(host.username).to eq 'staging_user' expect(host.path).to eq '/www/staging/current' end end context "with invalid uri" do specify do expect { Dbcp::SshExecutionHost.new_from_uri 'staging.example.com' }.to raise_error URI::InvalidURIError end end end describe "#execute" do # Not sure how to either easily unit test, or securely/portably integration test. Suggested appreciated. end describe "#download" do let(:path) { '/tmp/foo' } it "uses ssh" do expect(Net::SFTP).to receive(:start).with('staging.example.com', 'staging_user') { true } subject.download path, path end end describe "#upload" do let(:path) { '/tmp/foo' } it "uses SFTP" do expect(Net::SFTP).to receive(:start).with('staging.example.com', 'staging_user') { true } subject.upload path, path end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dbcp-0.1.0 | spec/lib/dbcp/execution_hosts/ssh_execution_host_spec.rb |
dbcp-0.0.1 | spec/lib/dbcp/execution_hosts/ssh_execution_host_spec.rb |