BigW Consortium Gitlab

Commit fc51bde9 by Bob Van Landuyt

Add a spec for editing a file when a project was already forked

parent 178f4e1e
require 'spec_helper'
describe 'User edits files' do
include ProjectForksHelper
let(:project) { create(:project, :repository, name: 'Shop') }
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
let(:project_tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
......@@ -122,7 +123,7 @@ describe 'User edits files' do
fill_in(:commit_message, with: 'New commit message', visible: true)
click_button('Commit changes')
fork = user.fork_of(project2)
fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork))
......@@ -130,5 +131,34 @@ describe 'User edits files' do
expect(page).to have_content('New commit message')
end
context 'when the user already had a fork of the project', :js do
let!(:forked_project) { fork_project(project2, user, namespace: user.namespace, repository: true) }
before do
visit(project2_tree_path_root_ref)
end
it 'links to the forked project for editing' do
click_link('.gitignore')
find('.js-edit-blob').click
expect(page).not_to have_link('Fork')
expect(page).not_to have_button('Cancel')
execute_script("ace.edit('editor').setValue('*.rbca')")
fill_in(:commit_message, with: 'Another commit', visible: true)
click_button('Commit changes')
fork = user.fork_of(project2)
expect(current_path).to eq(project_new_merge_request_path(fork))
wait_for_requests
expect(page).to have_content('Another commit')
expect(page).to have_content("From #{forked_project.full_path}")
expect(page).to have_content("into #{project2.full_path}")
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