Commit a6536a84 authored by Douwe Maan's avatar Douwe Maan

Fix some specs

parent cc3e488c
...@@ -209,8 +209,6 @@ module BlobHelper ...@@ -209,8 +209,6 @@ module BlobHelper
end end
def copy_blob_source_button(blob) def copy_blob_source_button(blob)
return unless blob.rendered_as_text?(override_max_size: params[:override_max_size])
clipboard_button(target: ".blob-content[data-blob-id='#{blob.id}']", class: "btn btn-sm js-copy-blob-source-btn", title: "Copy source to clipboard") clipboard_button(target: ".blob-content[data-blob-id='#{blob.id}']", class: "btn btn-sm js-copy-blob-source-btn", title: "Copy source to clipboard")
end end
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
= render 'projects/blob/viewer_switcher', blob: blob unless blame = render 'projects/blob/viewer_switcher', blob: blob unless blame
.btn-group{ role: "group" }< .btn-group{ role: "group" }<
= copy_blob_source_button(blob) unless blame = copy_blob_source_button(blob) if !blame && blob.rendered_as_text?(override_max_size: params[:override_max_size])
= open_raw_file_button(namespace_project_raw_path(@project.namespace, @project, @id)) = open_raw_file_button(namespace_project_raw_path(@project.namespace, @project, @id))
= view_on_environment_button(@commit.sha, @path, @environment) if @environment = view_on_environment_button(@commit.sha, @path, @environment) if @environment
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
.file-actions.hidden-xs .file-actions.hidden-xs
.btn-group{ role: "group" }< .btn-group{ role: "group" }<
= copy_blob_content_button(@snippet) = copy_blob_source_button(@snippet)
= open_raw_file_button(raw_path) = open_raw_file_button(raw_path)
- if defined?(download_path) && download_path - if defined?(download_path) && download_path
......
require 'spec_helper' require 'spec_helper'
feature 'user browses project', feature: true do feature 'user browses project', feature: true, js: true do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -24,6 +24,7 @@ feature 'user browses project', feature: true do ...@@ -24,6 +24,7 @@ feature 'user browses project', feature: true do
click_link 'files' click_link 'files'
click_link 'lfs' click_link 'lfs'
click_link 'lfs_object.iso' click_link 'lfs_object.iso'
wait_for_ajax
expect(page).not_to have_content 'Download (1.5 MB)' expect(page).not_to have_content 'Download (1.5 MB)'
expect(page).to have_content 'version https://git-lfs.github.com/spec/v1' expect(page).to have_content 'version https://git-lfs.github.com/spec/v1'
......
...@@ -56,15 +56,14 @@ describe BlobHelper do ...@@ -56,15 +56,14 @@ describe BlobHelper do
end end
end end
describe "#sanitize_svg" do describe "#sanitize_svg_data" do
let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') } let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') }
let(:data) { open(input_svg_path).read } let(:data) { open(input_svg_path).read }
let(:expected_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') } let(:expected_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') }
let(:expected) { open(expected_svg_path).read } let(:expected) { open(expected_svg_path).read }
it 'retains essential elements' do it 'retains essential elements' do
blob = OpenStruct.new(data: data) expect(sanitize_svg_data(data)).to eq(expected)
expect(sanitize_svg(blob).data).to eq(expected)
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