diff options
author | Stan Hu <stanhu@gmail.com> | 2015-06-09 17:43:08 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-06-18 20:35:48 +0300 |
commit | 62079d7654d1d994e6d4a1fff61e98297195e85d (patch) | |
tree | a518730aac78d5c7ad8a7491fd097f5969d6684f /spec/lib | |
parent | 0e615a486398166956ac612e1558abd1d44e1f8f (diff) |
Add init test for ProjectSearchResults
See: https://github.com/gitlabhq/gitlabhq/pull/9368#issuecomment-110350335
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/project_search_results_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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 00000000000..32a25f08cac --- /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 |