Skip to content

Commit

Permalink
Drop InstURL.is_network
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jun 16, 2016
1 parent 0f7ab3c commit 6ebab12
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
15 changes: 0 additions & 15 deletions src/modules/InstURL.rb
Expand Up @@ -20,7 +20,6 @@ def main
Yast.import "URL"
Yast.import "CheckMedia"

@is_network = nil
@installInf2Url = nil
end

Expand Down Expand Up @@ -103,19 +102,6 @@ def installInf2Url(extra_dir = "")
@installInf2Url
end

# Schemes considered local for installInf2Url
LOCAL_SCHEMES = ["cd", "dvd", "hd"]

# Determines whether the installation URL is remote or not
#
# @return [Boolean] true if it's remote; false otherwise.
# @see installInf2Url
def is_network
return @is_network unless @is_network.nil?
scheme = URL.Parse(installInf2Url("")).fetch("scheme")
@is_network = !LOCAL_SCHEMES.include?(scheme.downcase)
end

private

# Helper method to add extra_dir to a given URL
Expand Down Expand Up @@ -144,7 +130,6 @@ def add_ssl_verify_no_to_url(url)
URL.Build(parts)
end

publish :function => :is_network, :type => "boolean ()"
publish :function => :HidePassword, :type => "string (string)"
publish :function => :RewriteCDUrl, :type => "string (string)"
publish :function => :installInf2Url, :type => "string (string)"
Expand Down
39 changes: 0 additions & 39 deletions test/inst_url_test.rb
Expand Up @@ -60,43 +60,4 @@
end
end
end

describe "#is_network" do
before do
inst_url.main
expect(inst_url).to receive(:installInf2Url).and_return(url)
end

context "when URL is of type cd://" do
let(:url) { "cd:///?device=disk/by-id/ata-1" }

it "returns false" do
expect(inst_url.is_network).to eq(false)
end
end

context "when URL is of type dvd://" do
let(:url) { "dvd:///?device=disk/by-id/ata-1" }

it "returns false" do
expect(inst_url.is_network).to eq(false)
end
end

context "when URL is of type hd://" do
let(:url) { "hd:///?device=disk/by-id/ata-1" }

it "returns false" do
expect(inst_url.is_network).to eq(false)
end
end

context "when URL is remote" do
let(:url) { "http://download.opensuse.org/leap/DVD1" }

it "returns true" do
expect(inst_url.is_network).to eq(true)
end
end
end
end

0 comments on commit 6ebab12

Please sign in to comment.