diff options
Diffstat (limited to 'spec/haml_lint/linter/documentation_links_spec.rb')
-rw-r--r-- | spec/haml_lint/linter/documentation_links_spec.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/haml_lint/linter/documentation_links_spec.rb b/spec/haml_lint/linter/documentation_links_spec.rb index d47127d9661..ee34751de72 100644 --- a/spec/haml_lint/linter/documentation_links_spec.rb +++ b/spec/haml_lint/linter/documentation_links_spec.rb @@ -11,49 +11,49 @@ RSpec.describe HamlLint::Linter::DocumentationLinks, feature_category: :tooling shared_examples 'link validation rules' do |link_pattern| context 'when link_to points to the existing file path' do - let(:haml) { "= link_to 'Description', #{link_pattern}('index.md')" } + let(:haml) { "= link_to 'Description', #{link_pattern}('index')" } it { is_expected.not_to report_lint } end context 'when link_to points to the existing file with valid anchor' do - let(:haml) { "= link_to 'Description', #{link_pattern}('index.md', anchor: 'user-account'), target: '_blank'" } + let(:haml) { "= link_to 'Description', #{link_pattern}('index', anchor: 'user-account'), target: '_blank'" } it { is_expected.not_to report_lint } end - context 'when link_to points to the existing file path without .md extension' do - let(:haml) { "= link_to 'Description', #{link_pattern}('index')" } + context 'when link_to points to the existing file path with .md extension' do + let(:haml) { "= link_to 'Description', #{link_pattern}('index.md')" } - it { is_expected.not_to report_lint } + it { is_expected.to report_lint } end context 'when anchor is not correct' do - let(:haml) { "= link_to 'Description', #{link_pattern}('index.md', anchor: 'wrong')" } + let(:haml) { "= link_to 'Description', #{link_pattern}('index', anchor: 'wrong')" } it { is_expected.to report_lint } context "when #{link_pattern} has multiple options" do - let(:haml) { "= link_to 'Description', #{link_pattern}('index.md', key: :value, anchor: 'wrong')" } + let(:haml) { "= link_to 'Description', #{link_pattern}('index', key: :value, anchor: 'wrong')" } it { is_expected.to report_lint } end end context 'when file path is wrong' do - let(:haml) { "= link_to 'Description', #{link_pattern}('wrong.md'), target: '_blank'" } + let(:haml) { "= link_to 'Description', #{link_pattern}('wrong'), target: '_blank'" } it { is_expected.to report_lint } context 'when haml ends with block definition' do - let(:haml) { "= link_to 'Description', #{link_pattern}('wrong.md') do" } + let(:haml) { "= link_to 'Description', #{link_pattern}('wrong') do" } it { is_expected.to report_lint } end end context 'when link with wrong file path is assigned to a variable' do - let(:haml) { "- my_link = link_to 'Description', #{link_pattern}('wrong.md')" } + let(:haml) { "- my_link = link_to 'Description', #{link_pattern}('wrong')" } it { is_expected.to report_lint } end @@ -65,13 +65,13 @@ RSpec.describe HamlLint::Linter::DocumentationLinks, feature_category: :tooling end context 'when anchor belongs to a different element' do - let(:haml) { "= link_to 'Description', #{link_pattern}('index.md'), target: (anchor: 'blank')" } + let(:haml) { "= link_to 'Description', #{link_pattern}('index'), target: (anchor: 'blank')" } it { is_expected.not_to report_lint } end context "when a simple #{link_pattern}" do - let(:haml) { "- url = #{link_pattern}('wrong.md')" } + let(:haml) { "- url = #{link_pattern}('wrong')" } it { is_expected.to report_lint } end @@ -83,13 +83,13 @@ RSpec.describe HamlLint::Linter::DocumentationLinks, feature_category: :tooling end context 'when link is a part of the tag' do - let(:haml) { ".data-form{ data: { url: #{link_pattern}('wrong.md') } }" } + let(:haml) { ".data-form{ data: { url: #{link_pattern}('wrong') } }" } it { is_expected.to report_lint } end context 'when the second link is invalid' do - let(:haml) { ".data-form{ data: { url: #{link_pattern}('index.md'), wrong_url: #{link_pattern}('wrong.md') } }" } + let(:haml) { ".data-form{ data: { url: #{link_pattern}('index'), wrong_url: #{link_pattern}('wrong') } }" } it { is_expected.to report_lint } end |