Commit ad17617d authored by Jacob Vosmaer's avatar Jacob Vosmaer

Changes proposed during review

parent ae21774c
...@@ -9,7 +9,7 @@ class GitlabKeys ...@@ -9,7 +9,7 @@ class GitlabKeys
attr_accessor :auth_file, :key attr_accessor :auth_file, :key
def self.command(key_id) def self.command(key_id)
raise KeyError.new("Invalid key_id: #{key_id.inspect}") unless /\A[a-z0-9-]+\z/.match(key_id) raise KeyError.new("Invalid key_id: #{key_id.inspect}") unless /\A[a-z0-9-]+\z/ =~ key_id
"#{ROOT_PATH}/bin/gitlab-shell #{key_id}" "#{ROOT_PATH}/bin/gitlab-shell #{key_id}"
end end
......
...@@ -14,7 +14,7 @@ describe GitlabKeys do ...@@ -14,7 +14,7 @@ describe GitlabKeys do
end end
it 'raises KeyError on invalid input' do it 'raises KeyError on invalid input' do
expect { described_class.command("\nssh-rsa AAA") }.to raise_error(GitlabKeys::KeyError) expect { described_class.command("\nssh-rsa AAA") }.to raise_error(described_class::KeyError)
end end
end end
...@@ -29,7 +29,7 @@ describe GitlabKeys do ...@@ -29,7 +29,7 @@ describe GitlabKeys do
end end
it 'raises KeyError on invalid input' do it 'raises KeyError on invalid input' do
expect { described_class.key_line('key-741', "ssh-rsa AAA\nssh-rsa AAA") }.to raise_error(GitlabKeys::KeyError) expect { described_class.key_line('key-741', "ssh-rsa AAA\nssh-rsa AAA") }.to raise_error(described_class::KeyError)
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