Skip to content
代码片段 群组 项目
提交 b74fa53f 编辑于 作者: Lavi Arzi's avatar Lavi Arzi 提交者: Igor Drozdov
浏览文件

Replace single quote strings with double quote strings to enable the...

Replace single quote strings with double quote strings to enable the interpolated variables set in the previous commit
上级 70654c73
No related branches found
No related tags found
无相关合并请求
......@@ -8,6 +8,6 @@ class LfsFileLockEntity < Grape::Entity
expose(:created_at, as: :locked_at) { |entity| entity.created_at.to_fs(:iso8601) }
expose :owner do
expose(:name) { |entity| entity.user&.name }
expose(:name) { |entity| entity.user&.username }
end
end
......@@ -7,10 +7,10 @@ def can_unlock?(path_lock, current_user = @current_user)
def text_label_for_lock(file_lock, path)
if file_lock.path == path
"Locked by #{file_lock.user.name}"
"Locked by #{file_lock.user.username}"
else
# Nested lock
"#{file_lock.user.name} has a lock on \"#{file_lock.path}\""
"#{file_lock.user.username} has a lock on \"#{file_lock.path}\""
end
end
end
......@@ -23,11 +23,11 @@
describe '#text_label_for_lock' do
it "return correct string for non-nested locks" do
expect(text_label_for_lock(path_lock, 'app')).to eq('Locked by John')
expect(text_label_for_lock(path_lock, 'app')).to eq("Locked by #{user.username}")
end
it "return correct string for nested locks" do
expect(text_label_for_lock(path_lock, 'app/models')).to eq('John has a lock on "app"')
expect(text_label_for_lock(path_lock, 'app/models')).to eq("#{user.username} has a lock on \"app\"")
end
end
end
......@@ -14,7 +14,7 @@
describe '#summarize (entries)' do
it 'includes path locks in entries' do
is_expected.to contain_exactly(
a_hash_including(file_name: 'a.txt', lock_label: "Locked by #{path_lock.user.name}")
a_hash_including(file_name: 'a.txt', lock_label: "Locked by #{path_lock.user.username}")
)
end
end
......
......@@ -74,7 +74,7 @@ def lfs_file_locks_validation
lfs_lock = project.lfs_file_locks.where(path: paths).where.not(user_id: user_access.user.id).take
if lfs_lock
return "The path '#{lfs_lock.path}' is locked in Git LFS by #{lfs_lock.user.name}"
return "The path '#{lfs_lock.path}' is locked in Git LFS by #{lfs_lock.user.username}"
end
end
end
......
......@@ -94,7 +94,7 @@
context 'when change is sent by a different user' do
it 'raises an error if the user is not allowed to update the file' do
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "The path 'README' is locked in Git LFS by #{lock.user.name}")
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "The path 'README' is locked in Git LFS by #{lock.user.username}")
end
end
......@@ -148,7 +148,7 @@
end
it "does raise an error" do
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "The path 'files/locked/baz.lfs' is locked in Git LFS by #{owner.name}")
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "The path 'files/locked/baz.lfs' is locked in Git LFS by #{owner.username}")
end
end
end
......
......@@ -16,6 +16,6 @@
it 'exposes the owner info' do
expect(subject).to include(:owner)
expect(subject[:owner][:name]).to eq(user.name)
expect(subject[:owner][:name]).to eq(user.username)
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册