diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-05-09 04:15:34 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2017-05-09 04:15:34 +0000 |
commit | 0151325dacebb99d54b6effb1d5842c0c712168c (patch) | |
tree | 767ea3c8cfeedab5a0ce1921d5842b149ea7c0be /spec/helpers | |
parent | 9ada13d343a4736275d2c026ee980abe5c5e5763 (diff) | |
download | gitlab-ce-0151325dacebb99d54b6effb1d5842c0c712168c.tar.gz |
Merge request widget redesign
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/merge_requests_helper_spec.rb | 192 |
1 files changed, 0 insertions, 192 deletions
diff --git a/spec/helpers/merge_requests_helper_spec.rb b/spec/helpers/merge_requests_helper_spec.rb index 10681af5f7e..f2c9d927388 100644 --- a/spec/helpers/merge_requests_helper_spec.rb +++ b/spec/helpers/merge_requests_helper_spec.rb @@ -21,55 +21,6 @@ describe MergeRequestsHelper do end end - describe '#issues_sentence' do - let(:project) { create :project } - - subject { issues_sentence(issues) } - let(:issues) do - [build(:issue, iid: 2, project: project), - build(:issue, iid: 3, project: project), - build(:issue, iid: 1, project: project)] - end - - it do - @project = project - - is_expected.to eq('#1, #2, and #3') - end - - context 'for JIRA issues' do - let(:project) { create(:empty_project) } - let(:issues) do - [ - ExternalIssue.new('JIRA-456', project), - ExternalIssue.new('FOOBAR-7890', project), - ExternalIssue.new('JIRA-123', project) - ] - end - - it do - @project = project - is_expected.to eq('FOOBAR-7890, JIRA-123, and JIRA-456') - end - end - - context 'for issues from multiple namespaces' do - let(:project) { create(:project) } - let(:other_project) { create(:project) } - let(:issues) do - [build(:issue, iid: 2, project: project), - build(:issue, iid: 3, project: other_project), - build(:issue, iid: 1, project: project)] - end - - it do - @project = project - - is_expected.to eq("#1, #2, and #{other_project.namespace.path}/#{other_project.path}#3") - end - end - end - describe '#format_mr_branch_names' do describe 'within the same project' do let(:merge_request) { create(:merge_request) } @@ -89,147 +40,4 @@ describe MergeRequestsHelper do it { is_expected.to eq([source_title, target_title]) } end end - - describe '#mr_widget_refresh_url' do - let(:guest) { create(:user) } - let(:project) { create(:project, :public) } - let(:project_fork) { Projects::ForkService.new(project, guest).execute } - let(:merge_request) { create(:merge_request, source_project: project_fork, target_project: project) } - - it 'returns correct url for MR' do - expected_url = "#{project.path_with_namespace}/merge_requests/#{merge_request.iid}/merge_widget_refresh" - - expect(mr_widget_refresh_url(merge_request)).to end_with(expected_url) - end - - it 'returns empty string for nil' do - expect(mr_widget_refresh_url(nil)).to eq('') - end - end - - describe '#mr_closes_issues' do - let(:user_1) { create(:user) } - let(:user_2) { create(:user) } - - let(:project_1) { create(:project, :private, creator: user_1, namespace: user_1.namespace) } - let(:project_2) { create(:project, :private, creator: user_2, namespace: user_2.namespace) } - - let(:issue_1) { create(:issue, project: project_1) } - let(:issue_2) { create(:issue, project: project_2) } - - let(:merge_request) { create(:merge_request, source_project: project_1, target_project: project_1,) } - - let(:merge_request) do - create(:merge_request, - source_project: project_1, target_project: project_1, - description: "Fixes #{issue_1.to_reference} Fixes #{issue_2.to_reference(project_1)}") - end - - before do - project_1.team << [user_2, :developer] - project_2.team << [user_2, :developer] - allow(merge_request.project).to receive(:default_branch).and_return(merge_request.target_branch) - @merge_request = merge_request - end - - context 'user without access to another private project' do - let(:current_user) { user_1 } - - it 'cannot see that project\'s issue that will be closed on acceptance' do - expect(mr_closes_issues).to contain_exactly(issue_1) - end - end - - context 'user with access to another private project' do - let(:current_user) { user_2 } - - it 'can see that project\'s issue that will be closed on acceptance' do - expect(mr_closes_issues).to contain_exactly(issue_1, issue_2) - end - end - end - - describe '#target_projects' do - let(:project) { create(:empty_project) } - let(:fork_project) { create(:empty_project, forked_from_project: project) } - - context 'when target project has enabled merge requests' do - it 'returns the forked_from project' do - expect(target_projects(fork_project)).to contain_exactly(project, fork_project) - end - end - - context 'when target project has disabled merge requests' do - it 'returns the forked project' do - project.project_feature.update(merge_requests_access_level: 0) - - expect(target_projects(fork_project)).to contain_exactly(fork_project) - end - end - end - - describe '#new_mr_path_from_push_event' do - subject(:url_params) { URI.decode_www_form(new_mr_path_from_push_event(event)).to_h } - let(:user) { create(:user) } - let(:project) { create(:empty_project, creator: user) } - let(:fork_project) { create(:project, forked_from_project: project, creator: user) } - let(:event) do - push_data = Gitlab::DataBuilder::Push.build_sample(fork_project, user) - create(:event, :pushed, project: fork_project, target: fork_project, author: user, data: push_data) - end - - context 'when target project has enabled merge requests' do - it 'returns link to create merge request on source project' do - expect(url_params['merge_request[target_project_id]'].to_i).to eq(project.id) - end - end - - context 'when target project has disabled merge requests' do - it 'returns link to create merge request on forked project' do - project.project_feature.update(merge_requests_access_level: 0) - - expect(url_params['merge_request[target_project_id]'].to_i).to eq(fork_project.id) - end - end - end - - describe '#mr_issues_mentioned_but_not_closing' do - let(:user_1) { create(:user) } - let(:user_2) { create(:user) } - - let(:project_1) { create(:project, :private, creator: user_1, namespace: user_1.namespace) } - let(:project_2) { create(:project, :private, creator: user_2, namespace: user_2.namespace) } - - let(:issue_1) { create(:issue, project: project_1) } - let(:issue_2) { create(:issue, project: project_2) } - - let(:merge_request) do - create(:merge_request, - source_project: project_1, target_project: project_1, - description: "#{issue_1.to_reference} #{issue_2.to_reference(project_1)}") - end - - before do - project_1.team << [user_2, :developer] - project_2.team << [user_2, :developer] - allow(merge_request.project).to receive(:default_branch).and_return(merge_request.target_branch) - @merge_request = merge_request - end - - context 'user without access to another private project' do - let(:current_user) { user_1 } - - it 'cannot see that project\'s issue that will be closed on acceptance' do - expect(mr_issues_mentioned_but_not_closing).to contain_exactly(issue_1) - end - end - - context 'user with access to another private project' do - let(:current_user) { user_2 } - - it 'can see that project\'s issue that will be closed on acceptance' do - expect(mr_issues_mentioned_but_not_closing).to contain_exactly(issue_1, issue_2) - end - end - end end |