Remove duplicate #parse_host method
This commit is contained in:
parent
944853ab47
commit
e7391359e8
|
@ -33,16 +33,6 @@ module VagrantPlugins
|
||||||
ftp.connect(&block)
|
ftp.connect(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse the host into it's url and port parts.
|
|
||||||
# @return [Array]
|
|
||||||
def parse_host(host)
|
|
||||||
if host.include?(":")
|
|
||||||
host.split(":", 2)
|
|
||||||
else
|
|
||||||
[host, "22"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# The list of all files that should be pushed by this push. This method
|
# The list of all files that should be pushed by this push. This method
|
||||||
# only returns **files**, not folders or symlinks!
|
# only returns **files**, not folders or symlinks!
|
||||||
# @return [Array<String>]
|
# @return [Array<String>]
|
||||||
|
|
|
@ -93,34 +93,6 @@ describe VagrantPlugins::FTPPush::Push do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#parse_host" do
|
|
||||||
let(:result) { subject.parse_host(host) }
|
|
||||||
|
|
||||||
context "when no port is given" do
|
|
||||||
let(:host) { "127.0.0.1" }
|
|
||||||
|
|
||||||
it "returns the url and port 22" do
|
|
||||||
expect(result).to eq(["127.0.0.1", "22"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when a port is given" do
|
|
||||||
let(:host) { "127.0.0.1:23456" }
|
|
||||||
|
|
||||||
it "returns the url and port 23456" do
|
|
||||||
expect(result).to eq(["127.0.0.1", "23456"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when more than more port is given" do
|
|
||||||
let(:host) { "127.0.0.1:22:33:44" }
|
|
||||||
|
|
||||||
it "returns the url and everything after" do
|
|
||||||
expect(result).to eq(["127.0.0.1", "22:33:44"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#all_files" do
|
describe "#all_files" do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
@dir = Dir.mktmpdir
|
@dir = Dir.mktmpdir
|
||||||
|
|
Loading…
Reference in New Issue