Commit 9053f8eb authored by James Lopez's avatar James Lopez

fix specs

parent b8d7367a
...@@ -17,7 +17,7 @@ module BlobHelper ...@@ -17,7 +17,7 @@ module BlobHelper
end end
def edit_blob_link(project = @project, ref = @ref, path = @path, options = {}) def edit_blob_link(project = @project, ref = @ref, path = @path, options = {})
return unless readable_blob?(options, path, project, ref) return unless blob = readable_blob(options, path, project, ref)
common_classes = "btn js-edit-blob #{options[:extra_class]}" common_classes = "btn js-edit-blob #{options[:extra_class]}"
...@@ -45,7 +45,7 @@ module BlobHelper ...@@ -45,7 +45,7 @@ module BlobHelper
def ide_blob_link(project = @project, ref = @ref, path = @path, options = {}) def ide_blob_link(project = @project, ref = @ref, path = @path, options = {})
return unless show_new_ide? return unless show_new_ide?
return unless readable_blob?(options, path, project, ref) return unless blob = readable_blob(options, path, project, ref)
common_classes = "btn js-edit-ide #{options[:extra_class]}" common_classes = "btn js-edit-ide #{options[:extra_class]}"
...@@ -304,11 +304,11 @@ module BlobHelper ...@@ -304,11 +304,11 @@ module BlobHelper
options options
end end
def readable_blob?(options, path, project, ref) def readable_blob(options, path, project, ref)
blob = options.delete(:blob) blob = options.delete(:blob)
blob ||= project.repository.blob_at(ref, path) rescue nil blob ||= project.repository.blob_at(ref, path) rescue nil
blob && blob.readable_text? blob if blob&.readable_text?
end end
def edit_blob_fork(common_classes, options, path, project, ref) def edit_blob_fork(common_classes, options, path, project, ref)
......
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