diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-12 14:32:25 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-12 14:32:25 +0200 |
commit | ec19a960ca45c630872ef65f681d42ccc91b1c7f (patch) | |
tree | affb9f6604e310b1be0a0dd0a45e0d839030ca77 /spec/models | |
parent | 9ab12e099d10925c1e97d441cb7a3f8f9af31bd2 (diff) | |
download | gitlab-ce-ec19a960ca45c630872ef65f681d42ccc91b1c7f.tar.gz |
Add tests for repository search files
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/repository_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index a083dcb1274..d25351b0f0e 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -47,4 +47,28 @@ describe Repository do it { is_expected.to be_falsey } end end + + describe "search_files" do + let(:results) { repository.search_files('feature', 'master') } + subject { results } + + it { is_expected.to be_an Array } + + describe 'result' do + subject { results.first } + + it { is_expected.to be_an String } + it { expect(subject.lines[2]).to eq("master:CHANGELOG:188: - Feature: Replace teams with group membership\n") } + end + + describe 'parsing result' do + subject { repository.parse_search_result(results.first) } + + it { is_expected.to be_an OpenStruct } + it { expect(subject.filename).to eq('CHANGELOG') } + it { expect(subject.ref).to eq('master') } + it { expect(subject.startline).to eq(186) } + it { expect(subject.data.lines[2]).to eq(" - Feature: Replace teams with group membership\n") } + end + end end |