2015-06-09 10:43:08 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-09 05:55:36 -05:00
|
|
|
describe Gitlab::ProjectSearchResults, lib: true do
|
2015-06-09 10:43:08 -04:00
|
|
|
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 }
|
2015-10-14 19:14:24 -04:00
|
|
|
it { expect(results.query).to eq('hello world') }
|
2015-06-09 10:43:08 -04:00
|
|
|
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) }
|
2015-10-14 19:14:24 -04:00
|
|
|
it { expect(results.query).to eq('hello world') }
|
2015-06-09 10:43:08 -04:00
|
|
|
end
|
|
|
|
end
|