summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-04-20 18:01:47 -0500
committerDouwe Maan <douwe@selenight.nl>2017-04-27 12:23:26 -0500
commita6536a84e75952ffba7bb5cea07673963d820766 (patch)
tree41626fee9031aa4ba54517a4a93f1e18a255864d
parentcc3e488c984abe220cbecb35b61af5b04d93f90d (diff)
downloadgitlab-ce-a6536a84e75952ffba7bb5cea07673963d820766.tar.gz
Fix some specs
-rw-r--r--app/helpers/blob_helper.rb2
-rw-r--r--app/views/projects/blob/_header.html.haml2
-rw-r--r--app/views/shared/snippets/_blob.html.haml2
-rw-r--r--spec/features/projects/files/browse_files_spec.rb5
-rw-r--r--spec/helpers/blob_helper_spec.rb5
5 files changed, 7 insertions, 9 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index 8921f0c444a..0e369a63c87 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -209,8 +209,6 @@ module BlobHelper
end
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")
end
diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml
index ed63c6fc3c9..19eca2984db 100644
--- a/app/views/projects/blob/_header.html.haml
+++ b/app/views/projects/blob/_header.html.haml
@@ -15,7 +15,7 @@
= render 'projects/blob/viewer_switcher', blob: blob unless blame
.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))
= view_on_environment_button(@commit.sha, @path, @environment) if @environment
diff --git a/app/views/shared/snippets/_blob.html.haml b/app/views/shared/snippets/_blob.html.haml
index 895c3f1e99d..37c66ff2595 100644
--- a/app/views/shared/snippets/_blob.html.haml
+++ b/app/views/shared/snippets/_blob.html.haml
@@ -9,7 +9,7 @@
.file-actions.hidden-xs
.btn-group{ role: "group" }<
- = copy_blob_content_button(@snippet)
+ = copy_blob_source_button(@snippet)
= open_raw_file_button(raw_path)
- if defined?(download_path) && download_path
diff --git a/spec/features/projects/files/browse_files_spec.rb b/spec/features/projects/files/browse_files_spec.rb
index d281043caa3..70e96efd557 100644
--- a/spec/features/projects/files/browse_files_spec.rb
+++ b/spec/features/projects/files/browse_files_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-feature 'user browses project', feature: true do
+feature 'user browses project', feature: true, js: true do
let(:project) { create(:project) }
let(:user) { create(:user) }
@@ -13,7 +13,7 @@ feature 'user browses project', feature: true do
scenario "can see blame of '.gitignore'" do
click_link ".gitignore"
click_link 'Blame'
-
+
expect(page).to have_content "*.rb"
expect(page).to have_content "Dmitriy Zaporozhets"
expect(page).to have_content "Initial commit"
@@ -24,6 +24,7 @@ feature 'user browses project', feature: true do
click_link 'files'
click_link 'lfs'
click_link 'lfs_object.iso'
+ wait_for_ajax
expect(page).not_to have_content 'Download (1.5 MB)'
expect(page).to have_content 'version https://git-lfs.github.com/spec/v1'
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb
index 508aeb7cf67..292bc0d68fd 100644
--- a/spec/helpers/blob_helper_spec.rb
+++ b/spec/helpers/blob_helper_spec.rb
@@ -56,15 +56,14 @@ describe BlobHelper do
end
end
- describe "#sanitize_svg" do
+ describe "#sanitize_svg_data" do
let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') }
let(:data) { open(input_svg_path).read }
let(:expected_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') }
let(:expected) { open(expected_svg_path).read }
it 'retains essential elements' do
- blob = OpenStruct.new(data: data)
- expect(sanitize_svg(blob).data).to eq(expected)
+ expect(sanitize_svg_data(data)).to eq(expected)
end
end