tooltip=path_lock.user==current_user?'':"Locked by #{locker}"
enabled_lock_link("Unlock",tooltip,html_options)
else
disabled_lock_link("Unlock","Locked by #{locker}. You do not have permission to unlock this",html_options)
end
elsifpath_lock.upstream?(path)
ifcan_unlock?(path_lock)
disabled_lock_link("Unlock","#{locker} has a lock on \"#{path_lock.path}\". Unlock that directory in order to unlock this",html_options)
else
disabled_lock_link("Unlock","#{locker} has a lock on \"#{path_lock.path}\". You do not have permission to unlock it",html_options)
end
elsifpath_lock.downstream?(path)
ifcan_unlock?(path_lock)
disabled_lock_link("Lock","This directory cannot be locked while #{locker} has a lock on \"#{path_lock.path}\". Unlock this in order to proceed",html_options)
else
disabled_lock_link("Lock","This directory cannot be locked while #{locker} has a lock on \"#{path_lock.path}\". You do not have permission to unlock it",html_options)
expect(helper.lock_file_link(project,requested_path)).tomatch(html_escape("#{user.name} has a lock on \"app/models\". Unlock that directory in order to unlock this"))
expect(helper.lock_file_link(project,requested_path)).tomatch(html_escape("#{user.name} has a lock on \"app/models\". You do not have permission to unlock it"))
end
end
context"downstream lock"do
it"returns Lock with no toltip"do
expect(helper.lock_file_link(project,'app')).tomatch(html_escape("This directory cannot be locked while #{user.name} has a lock on \"app/models\". Unlock this in order to proceed"))
expect(helper.lock_file_link(project,'app')).tomatch(html_escape("This directory cannot be locked while #{user.name} has a lock on \"app/models\". You do not have permission to unlock it"))
expect(helper.lock_file_link(project,requested_path)).tomatch(html_escape("#{user.name} has a lock on \"app/models\". Unlock that directory in order to unlock this"))
expect(helper.lock_file_link(project,requested_path)).tomatch(html_escape("#{user.name} has a lock on \"app/models\". You do not have permission to unlock it"))
end
end
context"downstream lock"do
it"returns Lock with no toltip"do
expect(helper.lock_file_link(project,'app')).tomatch(html_escape("This directory cannot be locked while #{user.name} has a lock on \"app/models\". Unlock this in order to proceed"))
expect(helper.lock_file_link(project,'app')).tomatch(html_escape("This directory cannot be locked while #{user.name} has a lock on \"app/models\". You do not have permission to unlock it"))