diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-01 15:37:51 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-01 15:37:51 +0300 |
commit | 4581e71c44c72d1e5e40e9ad00f3d136334ac931 (patch) | |
tree | 6b29258fbbd3e333b2aad7b117db3ae112be938c /spec/features | |
parent | d1c537ad32cdb4993d09318de3a6debf1d37261d (diff) | |
parent | 888e6fad3e78537de2884d738248f2daa1c5958f (diff) |
Merge branch 'fix/error-500-in-pipeline-when-fork' into 'master'
Use project that belongs to pipeline in view
## What does this MR do?
This MR makes project in pipelines view match the one that pipeline has been created for.
Closes #17943
See merge request !4376
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/merge_requests/created_from_fork_spec.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb new file mode 100644 index 00000000000..edc0bdec3db --- /dev/null +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +feature 'Merge request created from fork' do + given(:user) { create(:user) } + given(:project) { create(:project, :public) } + given(:fork_project) { create(:project, :public) } + + given!(:merge_request) do + create(:forked_project_link, forked_to_project: fork_project, + forked_from_project: project) + + create(:merge_request_with_diffs, source_project: fork_project, + target_project: project, + description: 'Test merge request') + end + + background do + fork_project.team << [user, :master] + login_as user + end + + scenario 'user can access merge request' do + visit_merge_request(merge_request) + + expect(page).to have_content 'Test merge request' + end + + context 'pipeline present in source project' do + include WaitForAjax + + given(:pipeline) do + create(:ci_commit_with_two_jobs, project: fork_project, + sha: merge_request.last_commit.id, + ref: merge_request.source_branch) + end + + background { pipeline.create_builds(user) } + + scenario 'user visits a pipelines page', js: true do + visit_merge_request(merge_request) + page.within('.merge-request-tabs') { click_link 'Builds' } + wait_for_ajax + + page.within('table.builds') do + expect(page).to have_content 'rspec' + expect(page).to have_content 'spinach' + end + + expect(find_link('Cancel running')[:href]) + .to include fork_project.path_with_namespace + end + end + + def visit_merge_request(mr) + visit namespace_project_merge_request_path(project.namespace, + project, mr) + end +end |