Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2023-07-20 04:59:34 +0300
committerAsh McKenzie <amckenzie@gitlab.com>2023-07-20 04:59:34 +0300
commit500533894852d9497439b8e76ad7e4bee0a42071 (patch)
treed0fefb99054d26fc6f1bd71cea604f086c24bf51
parentb51a863799f0ea093b0d23363b37a2b565334aad (diff)
parent599d0237dd8f137367a1657b87476595c12fa058 (diff)
Merge branch '1678-breadcrumb-rspec' into 'main'
Update breadcrumb separator Closes #1678 See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/4090 Merged-by: Ash McKenzie <amckenzie@gitlab.com> Approved-by: Ash McKenzie <amckenzie@gitlab.com> Reviewed-by: Ash McKenzie <amckenzie@gitlab.com> Co-authored-by: Sarah German <sgerman@gitlab.com>
-rw-r--r--lib/helpers/generic.rb2
-rw-r--r--spec/lib/helpers/generic_spec.rb38
2 files changed, 27 insertions, 13 deletions
diff --git a/lib/helpers/generic.rb b/lib/helpers/generic.rb
index afc39811..7feb7ec0 100644
--- a/lib/helpers/generic.rb
+++ b/lib/helpers/generic.rb
@@ -195,7 +195,7 @@ module Nanoc::Helpers
def docs_breadcrumb_list(path)
data = get_nav_sections
list = breadcrumb_trail(data, path[1..])
- list.map { |item| item[:name] }.join(", ")
+ list.map { |item| item[:name] }.join(" &rsaquo; ")
end
end
end
diff --git a/spec/lib/helpers/generic_spec.rb b/spec/lib/helpers/generic_spec.rb
index 6fa9d4fb..f8b4436a 100644
--- a/spec/lib/helpers/generic_spec.rb
+++ b/spec/lib/helpers/generic_spec.rb
@@ -12,17 +12,17 @@ RSpec.describe Nanoc::Helpers::Generic do
item.new(path)
end
+ before do
+ mock_items = { '/_data/navigation.yaml' => YAML.load_file('spec/lib/fixtures/navigation-mock.yaml', symbolize_names: true) }
+ mock_sections = mock_items['/_data/navigation.yaml'][:sections]
+ allow(mock_class).to receive(:get_nav_sections).and_return(mock_sections)
+ end
+
describe '#docs_section' do
using RSpec::Parameterized::TableSyntax
subject { mock_class.docs_section(mock_item.path.to_s) }
- before do
- mock_items = { '/_data/navigation.yaml' => YAML.load_file('spec/lib/fixtures/navigation-mock.yaml', symbolize_names: true) }
- mock_sections = mock_items['/_data/navigation.yaml'][:sections]
- allow(mock_class).to receive(:get_nav_sections).and_return(mock_sections)
- end
-
where(:path, :expected_section_title) do
"/ee/tutorials/" | "Learn GitLab with tutorials"
"/ee/topics/set_up_organization.html" | "Use GitLab"
@@ -39,12 +39,6 @@ RSpec.describe Nanoc::Helpers::Generic do
end
describe '#build_breadcrumb_list' do
- before do
- mock_items = { '/_data/navigation.yaml' => YAML.load_file('spec/lib/fixtures/navigation-mock.yaml', symbolize_names: true) }
- mock_sections = mock_items['/_data/navigation.yaml'][:sections]
- allow(mock_class).to receive(:get_nav_sections).and_return(mock_sections)
- end
-
# Test all six levels of the menu
let(:test_data) do
[
@@ -214,4 +208,24 @@ RSpec.describe Nanoc::Helpers::Generic do
end
end
end
+
+ describe '#docs_breadcrumb_list' do
+ using RSpec::Parameterized::TableSyntax
+
+ subject { mock_class.docs_breadcrumb_list(mock_item.path.to_s) }
+
+ where(:path, :expected_breadcrumb_list) do
+ "/ee/tutorials/" | "Learn GitLab with tutorials"
+ "/ee/topics/set_up_organization.html" | "Use GitLab &rsaquo; Set up your organization"
+ "/ee/user/project/autocomplete_characters.html" | "Use GitLab &rsaquo; Plan and track work &rsaquo; Quick actions &rsaquo; Autocomplete characters"
+ "/ee/user/project/settings/import_export_troubleshooting.html" | "Use GitLab &rsaquo; Organize work with projects &rsaquo; Migrate projects using file exports &rsaquo; Troubleshooting"
+ "/updog.html" | ""
+ end
+
+ with_them do
+ it "returns the breadcrumb trail for the given path" do
+ expect(subject).to eq(expected_breadcrumb_list)
+ end
+ end
+ end
end