2017-07-27 01:52:21 +05:30
|
|
|
require "utils/svn"
|
|
|
|
|
|
|
|
describe Utils do
|
|
|
|
describe "#self.svn_available?" do
|
2017-07-27 04:18:43 +05:30
|
|
|
it "returns true if svn --version command succeeds" do
|
|
|
|
allow_any_instance_of(Process::Status).to receive(:success?).and_return(true)
|
2017-07-27 01:52:21 +05:30
|
|
|
expect(described_class.svn_available?).to be_truthy
|
|
|
|
end
|
|
|
|
|
2017-07-27 04:18:43 +05:30
|
|
|
it "returns false if svn --version command does not succeed" do
|
|
|
|
allow_any_instance_of(Process::Status).to receive(:success?).and_return(false)
|
|
|
|
expect(described_class.svn_available?).to be_falsey
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns svn version if already set" do
|
2017-07-27 01:52:21 +05:30
|
|
|
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/" }
|
|
|
|
|
2017-07-27 04:18:43 +05:30
|
|
|
it "returns true when svn is not available" do
|
2017-07-27 01:52:21 +05:30
|
|
|
described_class.instance_variable_set(:@svn, false)
|
|
|
|
expect(described_class.svn_remote_exists(url)).to be_truthy
|
|
|
|
end
|
|
|
|
|
2017-07-27 04:18:43 +05:30
|
|
|
it "returns false when remote does not exist" do
|
|
|
|
expect(described_class.svn_remote_exists(url)).to be_falsey
|
2017-07-27 01:52:21 +05:30
|
|
|
end
|
|
|
|
|
2017-07-27 04:18:43 +05:30
|
|
|
it "returns true when remote exists" do
|
2017-07-27 01:52:21 +05:30
|
|
|
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
|