diff options
author | Stan Hu <stanhu@gmail.com> | 2015-10-01 06:50:53 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-10-01 06:50:53 +0300 |
commit | 5544d54793c49b072e7b46b847d01307ce3754e7 (patch) | |
tree | 6bf63658521f2f6c1aa0704446f3374986a47e38 /spec/helpers/merge_requests_helper_spec.rb | |
parent | 2714d5b8147cef39343a1c35ba099ebe6445f5e4 (diff) |
Include full path of source and target branch names in New Merge Request page
Previous title would only show the group name, which could be confusing.
Closes #2875
Diffstat (limited to 'spec/helpers/merge_requests_helper_spec.rb')
-rw-r--r-- | spec/helpers/merge_requests_helper_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/helpers/merge_requests_helper_spec.rb b/spec/helpers/merge_requests_helper_spec.rb new file mode 100644 index 00000000000..0ef1efb8bce --- /dev/null +++ b/spec/helpers/merge_requests_helper_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe MergeRequestsHelper do + describe "#issues_sentence" do + subject { issues_sentence(issues) } + let(:issues) do + [build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)] + end + + it { is_expected.to eq('#1, #2, and #3') } + end + + describe "#format_mr_branch_names" do + describe "within the same project" do + let(:merge_request) { create(:merge_request) } + subject { format_mr_branch_names(merge_request) } + + it { is_expected.to eq([merge_request.source_branch, merge_request.target_branch]) } + end + + describe "within different projects" do + let(:project) { create(:project) } + let(:fork_project) { create(:project, forked_from_project: project) } + let(:merge_request) { create(:merge_request, source_project: fork_project, target_project: project) } + subject { format_mr_branch_names(merge_request) } + let(:source_title) { "#{fork_project.path_with_namespace}:#{merge_request.source_branch}" } + let(:target_title) { "#{project.path_with_namespace}:#{merge_request.target_branch}" } + + it { is_expected.to eq([source_title, target_title]) } + end + end +end |