summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-10-05 18:08:16 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-10-05 18:08:16 +0800
commitf11ebb9556612f663264868a24ee8b774babda32 (patch)
tree73c6e88ea55caa805f4f2af0005f8ef1d9d6fd19
parentd2a9eefbfe86f1a152673d34f5803107c79c7d51 (diff)
downloadgitlab-ce-f11ebb9556612f663264868a24ee8b774babda32.tar.gz
Add a view test for showing source commits
-rw-r--r--spec/views/projects/merge_requests/_commits.html.haml_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb
new file mode 100644
index 00000000000..6f70b3daf8e
--- /dev/null
+++ b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+
+describe 'projects/merge_requests/show/_commits.html.haml' do
+ include Devise::Test::ControllerHelpers
+
+ let(:user) { create(:user) }
+ let(:target_project) { create(:project) }
+
+ let(:source_project) do
+ create(:project, forked_from_project: target_project)
+ end
+
+ let(:merge_request) do
+ create(:merge_request, :simple,
+ source_project: source_project,
+ target_project: target_project,
+ author: user)
+ end
+
+ before do
+ controller.prepend_view_path('app/views/projects')
+
+ assign(:merge_request, merge_request)
+ assign(:commits, merge_request.commits)
+ end
+
+ it 'shows commits from source project' do
+ render
+
+ commit = source_project.commit(merge_request.source_branch)
+ href = namespace_project_commit_path(
+ source_project.namespace,
+ source_project,
+ commit)
+
+ expect(rendered).to have_link(Commit.truncate_sha(commit.sha), href: href)
+ end
+end