Commit dca1aed1 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'rc/qa_leaky_constants' into 'master'

Fixes for RSpec/LeakyConstantDeclaration

See merge request gitlab-org/gitlab!30226
parents 9df4f5db 9c3f276b
......@@ -327,7 +327,6 @@ RSpec/LeakyConstantDeclaration:
Enabled: true
Exclude:
- 'spec/**/*.rb'
- 'qa/spec/**/*.rb'
RSpec/EmptyLineAfterHook:
Enabled: false
......
......@@ -2,7 +2,7 @@
describe QA::Resource::User do
describe "#fabricate_via_api!" do
Response = Struct.new(:code, :body)
response = Struct.new(:code, :body)
it 'fetches an existing user' do
existing_users = [
......@@ -13,8 +13,8 @@ describe QA::Resource::User do
web_url: ''
}
]
users_response = Response.new('200', JSON.dump(existing_users))
single_user_response = Response.new('200', JSON.dump(existing_users.first))
users_response = response.new('200', JSON.dump(existing_users))
single_user_response = response.new('200', JSON.dump(existing_users.first))
expect(subject).to receive(:api_get_from).with("/users?username=name").and_return(users_response)
expect(subject).to receive(:api_get_from).with("/users/0").and_return(single_user_response)
......@@ -26,7 +26,7 @@ describe QA::Resource::User do
end
it 'tries to create a user if it does not exist' do
expect(subject).to receive(:api_get_from).with("/users?username=foo").and_return(Response.new('200', '[]'))
expect(subject).to receive(:api_get_from).with("/users?username=foo").and_return(response.new('200', '[]'))
expect(subject).to receive(:api_post).and_return({ web_url: '' })
subject.username = 'foo'
......
......@@ -69,20 +69,20 @@ describe QA::Git::Repository do
end
describe '#fetch_supported_git_protocol' do
Result = Struct.new(:response)
result = Struct.new(:response)
it "reports the detected version" do
expect(repository).to receive(:run).and_return(Result.new("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')
end
it 'reports unknown if version is unknown' do
expect(repository).to receive(:run).and_return(Result.new("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')
end
it 'reports unknown if content does not identify a version' do
expect(repository).to receive(:run).and_return(Result.new("foo"))
expect(repository).to receive(:run).and_return(result.new("foo"))
expect(repository.fetch_supported_git_protocol).to eq('unknown')
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