diff options
| author | mansimarkaur | 2017-07-27 01:52:21 +0530 |
|---|---|---|
| committer | mansimarkaur | 2017-08-29 16:16:17 +0530 |
| commit | 13fb14a95f6d0c909451e94e96b14447ccabdfcb (patch) | |
| tree | e094d2775d964c6cc787cbbe31565c9c310a1249 /Library/Homebrew/test/utils/svn_spec.rb | |
| parent | 2a75c6c591c6bb0562ed25c84c951f70c9d8d90d (diff) | |
| download | brew-13fb14a95f6d0c909451e94e96b14447ccabdfcb.tar.bz2 | |
Added tests fir utils/svn
Diffstat (limited to 'Library/Homebrew/test/utils/svn_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/utils/svn_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Library/Homebrew/test/utils/svn_spec.rb b/Library/Homebrew/test/utils/svn_spec.rb new file mode 100644 index 000000000..35f8917aa --- /dev/null +++ b/Library/Homebrew/test/utils/svn_spec.rb @@ -0,0 +1,33 @@ +require "utils/svn" + +describe Utils do + describe "#self.svn_available?" do + it "processes value when @svn is not defined" do + expect(described_class.svn_available?).to be_truthy + end + + it "returns value of @svn when @svn is defined" do + described_class.instance_variable_set(:@svn, true) + expect(described_class.svn_available?).to be_truthy + end + end + + describe "#self.svn_remote_exists" do + let(:url) { "https://dl.bintray.com/homebrew/mirror/" } + + it "gives true when @svn is false" do + allow_any_instance_of(Process::Status).to receive(:success?).and_return(false) + described_class.instance_variable_set(:@svn, false) + expect(described_class.svn_remote_exists(url)).to be_truthy + end + + it "gives false when url is obscure" do + expect(described_class.svn_remote_exists(url)).to be_falsy + end + + it "gives true when quiet_system succeeds with given url" do + allow_any_instance_of(Process::Status).to receive(:success?).and_return(true) + expect(described_class.svn_remote_exists(url)).to be_truthy + end + end +end |
