Commit f479168b authored by Mark Lapierre's avatar Mark Lapierre

Update because run output is now a struct

The tests that use `fetch_supported_git_protocol` haven't
been running for a while, so when `run` output was changed
from a string to a struct, the method wasn't update because
nothing was using it.
parent 12ac49bf
...@@ -165,7 +165,7 @@ module QA ...@@ -165,7 +165,7 @@ module QA
# ls-remote is one command known to respond to Git protocol v2 so we use # ls-remote is one command known to respond to Git protocol v2 so we use
# it to get output including the version reported via Git tracing # it to get output including the version reported via Git tracing
output = run("git ls-remote #{uri}", "GIT_TRACE_PACKET=1") output = run("git ls-remote #{uri}", "GIT_TRACE_PACKET=1")
output[/git< version (\d+)/, 1] || 'unknown' output.response[/git< version (\d+)/, 1] || 'unknown'
end end
def try_add_credentials_to_netrc def try_add_credentials_to_netrc
......
...@@ -69,18 +69,20 @@ describe QA::Git::Repository do ...@@ -69,18 +69,20 @@ describe QA::Git::Repository do
end end
describe '#fetch_supported_git_protocol' do describe '#fetch_supported_git_protocol' do
Result = Struct.new(:response)
it "reports the detected version" do it "reports the detected version" do
expect(repository).to receive(:run).and_return("packet: git< version 2") expect(repository).to receive(:run).and_return(Result.new("packet: git< version 2"))
expect(repository.fetch_supported_git_protocol).to eq('2') expect(repository.fetch_supported_git_protocol).to eq('2')
end end
it 'reports unknown if version is unknown' do it 'reports unknown if version is unknown' do
expect(repository).to receive(:run).and_return("packet: git< version -1") expect(repository).to receive(:run).and_return(Result.new("packet: git< version -1"))
expect(repository.fetch_supported_git_protocol).to eq('unknown') expect(repository.fetch_supported_git_protocol).to eq('unknown')
end end
it 'reports unknown if content does not identify a version' do it 'reports unknown if content does not identify a version' do
expect(repository).to receive(:run).and_return("foo") expect(repository).to receive(:run).and_return(Result.new("foo"))
expect(repository.fetch_supported_git_protocol).to eq('unknown') expect(repository.fetch_supported_git_protocol).to eq('unknown')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment