From 62079d7654d1d994e6d4a1fff61e98297195e85d Mon Sep 17 00:00:00 2001
From: Stan Hu <stanhu@gmail.com>
Date: Tue, 9 Jun 2015 07:43:08 -0700
Subject: [PATCH] Add init test for ProjectSearchResults

See: https://github.com/gitlabhq/gitlabhq/pull/9368#issuecomment-110350335
---
 .../lib/gitlab/project_search_results_spec.rb | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 spec/lib/gitlab/project_search_results_spec.rb

diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb
new file mode 100644
index 0000000000..32a25f08ca
--- /dev/null
+++ b/spec/lib/gitlab/project_search_results_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe Gitlab::ProjectSearchResults do
+  let(:project) { create(:project) }
+  let(:query) { 'hello world' }
+
+  describe 'initialize with empty ref' do
+    let(:results) { Gitlab::ProjectSearchResults.new(project.id, query, '') }
+
+    it { expect(results.project).to eq(project) }
+    it { expect(results.repository_ref).to be_nil }
+    it { expect(results.query).to eq('hello\\ world') }
+  end
+
+  describe 'initialize with ref' do
+    let(:ref) { 'refs/heads/test' }
+    let(:results) { Gitlab::ProjectSearchResults.new(project.id, query, ref) }
+
+    it { expect(results.project).to eq(project) }
+    it { expect(results.repository_ref).to eq(ref) }
+    it { expect(results.query).to eq('hello\\ world') }
+  end
+end
-- 
2.30.9