BigW Consortium Gitlab

project_search_results_spec.rb 748 Bytes
Newer Older
1 2
require 'spec_helper'

Douwe Maan committed
3
describe Gitlab::ProjectSearchResults, lib: true do
4 5 6 7 8 9 10 11
  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 }
12
    it { expect(results.query).to eq('hello world') }
13 14 15 16 17 18 19 20
  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) }
21
    it { expect(results.query).to eq('hello world') }
22 23
  end
end