summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-12-02 22:17:59 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2019-12-02 22:17:59 +0530
commitd5700d3132e67cabc81da6db07b848f941040de2 (patch)
tree2d7ea2c829663d1c00996b75497861255806257f /spec
parent87fc4d22f869bde6f3fe3756718b6d12713c2bab (diff)
downloadchef-d5700d3132e67cabc81da6db07b848f941040de2.tar.gz
Use URI.escape for url with spaces
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/apt_repository_spec.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/spec/unit/provider/apt_repository_spec.rb b/spec/unit/provider/apt_repository_spec.rb
index df39abcd4e..7537f2a9fb 100644
--- a/spec/unit/provider/apt_repository_spec.rb
+++ b/spec/unit/provider/apt_repository_spec.rb
@@ -226,27 +226,32 @@ C5986B4F1257FFA86632CBA746181433FBB75451
describe "#build_repo" do
it "creates a repository string" do
- target = "deb http://test/uri unstable main\n"
+ target = "deb http://test/uri unstable main\n"
expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil)).to eql(target)
end
+ it "creates a repository string with spaces" do
+ target = "deb http://test/uri%20with%20spaces unstable main\n"
+ expect(provider.build_repo("http://test/uri with spaces", "unstable", "main", false, nil)).to eql(target)
+ end
+
it "creates a repository string with no distribution" do
- target = "deb http://test/uri main\n"
+ target = "deb http://test/uri main\n"
expect(provider.build_repo("http://test/uri", nil, "main", false, nil)).to eql(target)
end
it "creates a repository string with source" do
- target = "deb http://test/uri unstable main\ndeb-src http://test/uri unstable main\n"
+ target = "deb http://test/uri unstable main\ndeb-src http://test/uri unstable main\n"
expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, true)).to eql(target)
end
it "creates a repository string with options" do
- target = "deb [trusted=yes] http://test/uri unstable main\n"
+ target = "deb [trusted=yes] http://test/uri unstable main\n"
expect(provider.build_repo("http://test/uri", "unstable", "main", true, nil)).to eql(target)
end
it "handles a ppa repo" do
- target = "deb http://ppa.launchpad.net/chef/main/ubuntu unstable main\n"
+ target = "deb http://ppa.launchpad.net/chef/main/ubuntu unstable main\n"
expect(provider).to receive(:make_ppa_url).with("ppa:chef/main").and_return("http://ppa.launchpad.net/chef/main/ubuntu")
expect(provider.build_repo("ppa:chef/main", "unstable", "main", false, nil)).to eql(target)
end