diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-06-20 20:45:01 +0300 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-06-25 14:19:30 +0300 |
commit | db132bae1d0098dce835844bfa667c5377510d3c (patch) | |
tree | 0b690d78e0251ab6010e76aea7960a2f815b8935 /spec/features/projects | |
parent | 8fd2c08472afc3846ba28f97994a57143bc76eaf (diff) |
Support redirect paths starting with a dash
We use a leading dash for certain things like the WebIDE, which
had the side effect of losing the `params[:continue][:to]` param when
opening the WebIDE on a project where the user doesn't have push access
and therefore needs to fork the project first.
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/files/user_edits_files_spec.rb | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb index 683268d064a..e0fa9dbb5fa 100644 --- a/spec/features/projects/files/user_edits_files_spec.rb +++ b/spec/features/projects/files/user_edits_files_spec.rb @@ -118,19 +118,31 @@ describe 'Projects > Files > User edits files', :js do wait_for_requests end - it 'inserts a content of a file in a forked project' do - click_link('.gitignore') - find('.js-edit-blob').click - + def expect_fork_prompt expect(page).to have_link('Fork') expect(page).to have_button('Cancel') + expect(page).to have_content( + "You're not allowed to edit files in this project directly. "\ + "Please fork this project, make your changes there, and submit a merge request." + ) + end - click_link('Fork') - + def expect_fork_status expect(page).to have_content( "You're not allowed to make changes to this project directly. "\ "A fork of this project has been created that you can make changes in, so you can submit a merge request." ) + end + + it 'inserts a content of a file in a forked project' do + click_link('.gitignore') + click_button('Edit') + + expect_fork_prompt + + click_link('Fork') + + expect_fork_status find('.file-editor', match: :first) @@ -140,12 +152,24 @@ describe 'Projects > Files > User edits files', :js do expect(evaluate_script('ace.edit("editor").getValue()')).to eq('*.rbca') end + it 'opens the Web IDE in a forked project' do + click_link('.gitignore') + click_button('Web IDE') + + expect_fork_prompt + + click_link('Fork') + + expect_fork_status + + expect(page).to have_css('.ide .multi-file-tab', text: '.gitignore') + end + it 'commits an edited file in a forked project' do click_link('.gitignore') find('.js-edit-blob').click - expect(page).to have_link('Fork') - expect(page).to have_button('Cancel') + expect_fork_prompt click_link('Fork') |