diff options
Diffstat (limited to 'spec/lib/banzai/filter/markdown_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/markdown_filter_spec.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/lib/banzai/filter/markdown_filter_spec.rb b/spec/lib/banzai/filter/markdown_filter_spec.rb index c79cd58255d..64d65528426 100644 --- a/spec/lib/banzai/filter/markdown_filter_spec.rb +++ b/spec/lib/banzai/filter/markdown_filter_spec.rb @@ -6,20 +6,19 @@ RSpec.describe Banzai::Filter::MarkdownFilter, feature_category: :team_planning include FilterSpecHelper describe 'markdown engine from context' do - it 'defaults to CommonMark' do - expect_next_instance_of(Banzai::Filter::MarkdownEngines::CommonMark) do |instance| - expect(instance).to receive(:render).and_return('test') - end - - filter('test') + it 'finds the correct engine' do + expect(described_class.render_engine(:common_mark)).to eq Banzai::Filter::MarkdownEngines::CommonMark end - it 'uses CommonMark' do - expect_next_instance_of(Banzai::Filter::MarkdownEngines::CommonMark) do |instance| - expect(instance).to receive(:render).and_return('test') - end + it 'defaults to the DEFAULT_ENGINE' do + default_engine = Banzai::Filter::MarkdownFilter::DEFAULT_ENGINE.to_s.classify + default = "Banzai::Filter::MarkdownEngines::#{default_engine}".constantize + + expect(described_class.render_engine(nil)).to eq default + end - filter('test', { markdown_engine: :common_mark }) + it 'raise error for unrecognized engines' do + expect { described_class.render_engine(:foo_bar) }.to raise_error(NameError) end end |