-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove support for block and inline code
- Loading branch information
1 parent
df8516f
commit 8134e84
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
# rubocop:disable RSpec/FilePath | ||
RSpec.describe GovukFormsMarkdown::Renderer, "#block_code" do | ||
subject(:renderer) { described_class.new } | ||
|
||
it "does not format block_code" do | ||
expect(renderer.block_code("strong {\n color: rebeccapurple;\n}", "css").strip).to eq "<p class=\"govuk-body\">strong {\n color: rebeccapurple;\n}</p>" | ||
end | ||
|
||
describe "rendering errors" do | ||
it "does log an error for block_code being used" do | ||
renderer.block_code("strong {\n color: rebeccapurple;\n}", "css") | ||
expect(renderer.errors).to eq([:used_block_code]) | ||
end | ||
|
||
context "when block_code is called multiple times in a single render" do | ||
it "returns the warning exactly once" do | ||
renderer.block_code("strong {\n color: rebeccapurple;\n}", "css") | ||
renderer.block_code("strong {\n color: rebeccapurple;\n}", "css") | ||
|
||
expect(renderer.errors.length).to eq 1 | ||
expect(renderer.errors).to eq([:used_block_code]) | ||
end | ||
end | ||
end | ||
end | ||
# rubocop:enable RSpec/FilePath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
# rubocop:disable RSpec/FilePath | ||
RSpec.describe GovukFormsMarkdown::Renderer, "#codespan " do | ||
subject(:renderer) { described_class.new } | ||
|
||
it "does not format codespan" do | ||
expect(renderer.codespan("color: rebeccapurple;")).to eq "color: rebeccapurple;" | ||
end | ||
|
||
describe "rendering errors" do | ||
it "does log an error for codespan being used" do | ||
renderer.codespan("color: rebeccapurple;") | ||
expect(renderer.errors).to eq([:used_codespan]) | ||
end | ||
|
||
context "when codespan is called multiple times in a single render" do | ||
it "returns the warning exactly once" do | ||
renderer.codespan("color: rebeccapurple;") | ||
renderer.codespan("color: rebeccapurple;") | ||
|
||
expect(renderer.errors.length).to eq 1 | ||
expect(renderer.errors).to eq([:used_codespan]) | ||
end | ||
end | ||
end | ||
end | ||
# rubocop:enable RSpec/FilePath |