summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-04-04 15:57:17 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-04-04 15:57:17 +0000
commit6c6eef939aceba7f6314e3a43e9d212029fc2cb5 (patch)
tree05e1c1bc76ce38dbafa799d31a58ea5a4580545f /spec
parent20e3ed60935ca2b28cf1f632c5ce75f8dbac8e10 (diff)
parent7f32ad7097b8badcad98a52b9373d67ce7f33184 (diff)
downloadgitlab-ce-6c6eef939aceba7f6314e3a43e9d212029fc2cb5.tar.gz
Merge branch '30400-fix-blob-highlighting-in-search' into 'master'
Fix blob highlighting in search Closes #30400 See merge request !10420
Diffstat (limited to 'spec')
-rw-r--r--spec/features/search_spec.rb4
-rw-r--r--spec/lib/gitlab/project_search_results_spec.rb8
2 files changed, 9 insertions, 3 deletions
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb
index a6560a81096..40ef4c098b9 100644
--- a/spec/features/search_spec.rb
+++ b/spec/features/search_spec.rb
@@ -119,13 +119,15 @@ describe "Search", feature: true do
visit namespace_project_path(project.namespace, project)
page.within '.search' do
- fill_in 'search', with: 'def'
+ fill_in 'search', with: 'application.js'
click_button 'Go'
end
click_link "Code"
expect(page).to have_selector('.file-content .code')
+
+ expect(page).to have_selector("span.line[lang='javascript']")
end
end
diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb
index 9a8096208db..e0ebea63eb4 100644
--- a/spec/lib/gitlab/project_search_results_spec.rb
+++ b/spec/lib/gitlab/project_search_results_spec.rb
@@ -41,8 +41,10 @@ describe Gitlab::ProjectSearchResults, lib: true do
subject { described_class.parse_search_result(search_result) }
- it "returns a valid OpenStruct object" do
- is_expected.to be_an OpenStruct
+ it "returns a valid FoundBlob" do
+ is_expected.to be_an Gitlab::SearchResults::FoundBlob
+ expect(subject.id).to be_nil
+ expect(subject.path).to eq('CHANGELOG')
expect(subject.filename).to eq('CHANGELOG')
expect(subject.basename).to eq('CHANGELOG')
expect(subject.ref).to eq('master')
@@ -53,6 +55,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
context "when filename has extension" do
let(:search_result) { "master:CONTRIBUTE.md:5:- [Contribute to GitLab](#contribute-to-gitlab)\n" }
+ it { expect(subject.path).to eq('CONTRIBUTE.md') }
it { expect(subject.filename).to eq('CONTRIBUTE.md') }
it { expect(subject.basename).to eq('CONTRIBUTE') }
end
@@ -60,6 +63,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
context "when file under directory" do
let(:search_result) { "master:a/b/c.md:5:a b c\n" }
+ it { expect(subject.path).to eq('a/b/c.md') }
it { expect(subject.filename).to eq('a/b/c.md') }
it { expect(subject.basename).to eq('a/b/c') }
end