28 lines
704 B
Ruby
28 lines
704 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe PrettyText do
|
|
it "renders the hledger fence as a dashboard placeholder" do
|
|
SiteSetting.hledger_enabled = true
|
|
|
|
cooked = PrettyText.cook(<<~MD)
|
|
```hledger
|
|
2024-01-01 x
|
|
assets:cash 1 EUR
|
|
equity:opening -1 EUR
|
|
```
|
|
MD
|
|
|
|
expect(cooked).to include('class="hledger-dashboard"')
|
|
expect(cooked).not_to include("assets:cash")
|
|
end
|
|
|
|
it "keeps the code block when the plugin is disabled" do
|
|
SiteSetting.hledger_enabled = false
|
|
|
|
cooked = PrettyText.cook("```hledger\n2024-01-01 x\n```")
|
|
|
|
expect(cooked).not_to include("hledger-dashboard")
|
|
expect(cooked).to include("lang-hledger")
|
|
end
|
|
end
|