spec/unit/berkshelf/git_spec.rb in berkshelf-1.1.0 vs spec/unit/berkshelf/git_spec.rb in berkshelf-1.1.1
- old
+ new
@@ -83,19 +83,49 @@
it "returns true" do
subject.validate_uri("gituser@githost:solve.git").should be_true
end
end
+ context "given a valid git+ssh URI without an username" do
+ it "returns true" do
+ subject.validate_uri("git+ssh://host.com/repo").should be_true
+ end
+ end
+
+ context "given a valid git+ssh URI with an username" do
+ it "returns true" do
+ subject.validate_uri("git+ssh://user@host.com/repo").should be_true
+ end
+ end
+
+ context "given a valid URI with a dash in the hostname" do
+ it "returns true" do
+ subject.validate_uri("git://user@git-host.com/repo").should be_true
+ end
+ end
+
+ context "given a valid URI with host being a subdomain" do
+ it "returns true" do
+ subject.validate_uri("git://user@git.host.com/repo").should be_true
+ end
+ end
+
+ context "given a valid git+ssh URI with home directory expansion" do
+ it "returns true" do
+ subject.validate_uri("git+ssh://user@host.com/~repo").should be_true
+ end
+ end
+
context "given an invalid URI" do
it "returns false" do
subject.validate_uri(invalid_uri).should be_false
end
end
context "given a HTTP URI" do
- it "returns false" do
- subject.validate_uri(http_uri).should be_false
+ it "returns true" do
+ subject.validate_uri(http_uri).should be_true
end
end
context "given an integer" do
it "returns false" do
@@ -137,12 +167,10 @@
end
end
context "given a HTTP URI" do
it "raises InvalidGitURI" do
- lambda {
- subject.validate_uri!(http_uri)
- }.should raise_error(Berkshelf::InvalidGitURI)
+ subject.validate_uri!(http_uri).should be_true
end
end
context "given an integer" do
it "raises InvalidGitURI" do