diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-07-31 09:08:19 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-31 09:08:19 +0300 |
commit | ade320d2db05559e751197cbc73cabe67036b8f3 (patch) | |
tree | e3f0768738b9fd2172bb16fd1cd935fd3cfe62ae /spec/features/projects/wiki | |
parent | 7758fdf1ad14d488fbbbe7c25d21d9d3bc0c82aa (diff) |
Fix bug with Wiki pages encoding
Diffstat (limited to 'spec/features/projects/wiki')
-rw-r--r-- | spec/features/projects/wiki/user_views_wiki_page_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index 0ef7f35f64a..760324adacc 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -137,6 +137,26 @@ describe 'User views a wiki page' do end end + context 'when page has invalid content encoding' do + let(:content) { 'whatever'.force_encoding('ISO-8859-1') } + + before do + allow(Gitlab::EncodingHelper).to receive(:encode!).and_return(content) + + visit(project_wiki_path(project, wiki_page)) + end + + it 'does not show "Edit" button' do + expect(page).not_to have_selector('a.btn', text: 'Edit') + end + + it 'shows error' do + page.within(:css, '.flash-notice') do + expect(page).to have_content('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.') + end + end + end + it 'opens a default wiki page', :js do visit(project_path(project)) |