summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-09-18 12:02:01 -0700
committerStan Hu <stanhu@gmail.com>2015-09-18 12:02:01 -0700
commitde8497ca56a20f8c9362fdb8a9a8629a551f0a4d (patch)
tree68a7e0a144f5145adc5b0a0fce292ae04b662b0e /spec/controllers
parentac571623d88314c89773ecdb484fc1c4ea92de1a (diff)
downloadgitlab-ce-de8497ca56a20f8c9362fdb8a9a8629a551f0a4d.tar.gz
Fix Error 500 when comparing non-existing branchesfix-issue-2593
Closes #2593
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/compare_controller_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb
index b643b354073..2a447248b70 100644
--- a/spec/controllers/projects/compare_controller_spec.rb
+++ b/spec/controllers/projects/compare_controller_spec.rb
@@ -22,4 +22,30 @@ describe Projects::CompareController do
expect(assigns(:diffs).length).to be >= 1
expect(assigns(:commits).length).to be >= 1
end
+
+ describe 'non-existent refs' do
+ it 'invalid source ref' do
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ from: 'non-existent',
+ to: ref_to)
+
+ expect(response).to be_success
+ expect(assigns(:diffs)).to eq([])
+ expect(assigns(:commits)).to eq([])
+ end
+
+ it 'invalid target ref' do
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ from: ref_from,
+ to: 'non-existent')
+
+ expect(response).to be_success
+ expect(assigns(:diffs)).to eq(nil)
+ expect(assigns(:commits)).to eq(nil)
+ end
+ end
end