summaryrefslogtreecommitdiff
path: root/spec/features/projects/blobs/blob_show_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-05 12:31:10 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-05 12:31:10 +0200
commite944fd7064b5a04a334b6c500c9ee7db29a46538 (patch)
tree7418e54f3774ca676040a16a30a4a9cd7c922100 /spec/features/projects/blobs/blob_show_spec.rb
parent3aa92cb5cbe8456c845e16d14489591dd81dbcb3 (diff)
parent3a2b60f7a0109cdb84e8727a2625318a746e84dc (diff)
downloadgitlab-ce-e944fd7064b5a04a334b6c500c9ee7db29a46538.tar.gz
* commit '3a2b60f7a0109cdb84e8727a2625318a746e84dc': (254 commits) Fixed Karma spec Reject EE reserved namespace paths in CE as well Updated webpack config Include the bundler:audit job into the static-analysis job Document serializers Add artifact file page that uses the blob viewer Pipeline table mini graph dropdown remains open when table is refreshed Adds off for event hub Compile gitlab-shell go executables Allow to create new branch and empty WIP merge request from issue page Moved to a view spec Improving copy of CONTRIBUTING.md, PROCESS.md, and code_review.md Convert seconds to minutes and hours on chat notifations Disable navigation to Pages config if Pages is disabled Sort the network graph both by commit date and topographically. Add tooltips to note action buttons Add breadcrumb, build header and pipelines submenu to artifacts browser Update todos screenshots removes the possibility of commit messages having carriage returns Handle incoming emails from aliases correctly ...
Diffstat (limited to 'spec/features/projects/blobs/blob_show_spec.rb')
-rw-r--r--spec/features/projects/blobs/blob_show_spec.rb45
1 files changed, 41 insertions, 4 deletions
diff --git a/spec/features/projects/blobs/blob_show_spec.rb b/spec/features/projects/blobs/blob_show_spec.rb
index 6a6f8b4f4d5..5955623f565 100644
--- a/spec/features/projects/blobs/blob_show_spec.rb
+++ b/spec/features/projects/blobs/blob_show_spec.rb
@@ -159,7 +159,7 @@ feature 'File blob', :js, feature: true do
expect(page).to have_selector('.blob-viewer[data-type="rich"]')
# shows an error message
- expect(page).to have_content('The rendered file could not be displayed because it is stored in LFS. You can view the source or download it instead.')
+ expect(page).to have_content('The rendered file could not be displayed because it is stored in LFS. You can download it instead.')
# shows a viewer switcher
expect(page).to have_selector('.js-blob-viewer-switcher')
@@ -167,8 +167,8 @@ feature 'File blob', :js, feature: true do
# does not show a copy button
expect(page).not_to have_selector('.js-copy-blob-source-btn')
- # shows a raw button
- expect(page).to have_link('Open raw')
+ # shows a download button
+ expect(page).to have_link('Download')
end
end
@@ -231,7 +231,7 @@ feature 'File blob', :js, feature: true do
branch_name: 'master',
commit_message: "Add PDF",
file_path: 'files/test.pdf',
- file_content: File.read(Rails.root.join('spec/javascripts/blob/pdf/test.pdf'))
+ file_content: project.repository.blob_at('add-pdf-file', 'files/pdf/test.pdf').data
).execute
visit_blob('files/test.pdf')
@@ -332,4 +332,41 @@ feature 'File blob', :js, feature: true do
end
end
end
+
+ context 'empty file' do
+ before do
+ project.add_master(project.creator)
+
+ Files::CreateService.new(
+ project,
+ project.creator,
+ start_branch: 'master',
+ branch_name: 'master',
+ commit_message: "Add empty file",
+ file_path: 'files/empty.md',
+ file_content: ''
+ ).execute
+
+ visit_blob('files/empty.md')
+
+ wait_for_ajax
+ end
+
+ it 'displays an error' do
+ aggregate_failures do
+ # shows an error message
+ expect(page).to have_content('Empty file')
+
+ # does not show a viewer switcher
+ expect(page).not_to have_selector('.js-blob-viewer-switcher')
+
+ # does not show a copy button
+ expect(page).not_to have_selector('.js-copy-blob-source-btn')
+
+ # does not show a download or raw button
+ expect(page).not_to have_link('Download')
+ expect(page).not_to have_link('Open raw')
+ end
+ end
+ end
end