diff options
author | Sarah German <sgerman@gitlab.com> | 2023-07-19 22:23:02 +0300 |
---|---|---|
committer | Sarah German <sgerman@gitlab.com> | 2023-07-19 22:23:02 +0300 |
commit | 599d0237dd8f137367a1657b87476595c12fa058 (patch) | |
tree | 847806e36268f2de950fd7378d0e57201b25c3a8 /spec | |
parent | 23a15ad02f8846c7060ba25a2660a8874e83c0ec (diff) |
Update breadcrumb separator
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/helpers/generic_spec.rb | 38 |
1 files changed, 26 insertions, 12 deletions
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 › Set up your organization" + "/ee/user/project/autocomplete_characters.html" | "Use GitLab › Plan and track work › Quick actions › Autocomplete characters" + "/ee/user/project/settings/import_export_troubleshooting.html" | "Use GitLab › Organize work with projects › Migrate projects using file exports › 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 |