Skip to content

Commit 6d8f956

Browse files
committed
experiment: remove minitest dsl
This is to test whether parallelisation works when NOT using `Minitest::Spec::DSL`.
1 parent 04686c5 commit 6d8f956

1 file changed

Lines changed: 27 additions & 31 deletions

File tree

test/support/govspeak_preview_helper_test.rb

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,53 @@
11
require "test_helper"
22

33
class GovspeakPreviewHelperTest < ActionView::TestCase
4-
extend Minitest::Spec::DSL
5-
6-
it "should not alter urls to other sites" do
4+
test "should not alter urls to other sites" do
75
html = govspeak_to_html("no [change](http://external.example.com/page.html)")
86
assert_select_within_html html, "a[href=?]", "http://external.example.com/page.html", text: "change"
97
end
108

11-
it "should not alter mailto urls" do
9+
test "should not alter mailto urls" do
1210
html = govspeak_to_html("no [change](mailto:dave@example.com)")
1311
assert_select_within_html html, "a[href=?]", "mailto:dave@example.com", text: "change"
1412
end
1513

16-
it "should not alter invalid urls" do
14+
test "should not alter invalid urls" do
1715
html = govspeak_to_html("no [change](not a valid url)")
1816
assert_select_within_html html, "a[href=?]", "not%20a%20valid%20url", text: "change"
1917
end
2018

21-
it "should not alter partial urls" do
19+
test "should not alter partial urls" do
2220
html = govspeak_to_html("no [change](http://)")
2321
assert_select_within_html html, "a[href=?]", "http://", text: "change"
2422
end
2523

26-
it "should wrap output with a govspeak class" do
24+
test "should wrap output with a govspeak class" do
2725
html = govspeak_to_html("govspeak-text")
2826
assert_select_within_html html, ".govspeak", text: "govspeak-text"
2927
end
3028

31-
it "should mark the govspeak output as html safe" do
29+
test "should mark the govspeak output as html safe" do
3230
html = govspeak_to_html("govspeak-text")
3331
assert html.html_safe?
3432
end
3533

36-
it "should produce UTF-8 for HTML entities" do
34+
test "should produce UTF-8 for HTML entities" do
3735
html = govspeak_to_html("a ['funny'](/url) thing")
3836
assert_select_within_html html, "a", text: "‘funny’"
3937
end
4038

41-
it "does not change css class on buttons" do
39+
test "does not change css class on buttons" do
4240
html = govspeak_to_html("{button}[Link text](https://www.gov.uk){/button}")
4341
assert_select_within_html html, "a.govuk-button", "Link text"
4442
end
4543

46-
it "should only extract level two headers by default" do
44+
test "should only extract level two headers by default" do
4745
text = "# Heading 1\n\n## Heading 2\n\n### Heading 3"
4846
headers = govspeak_headers(text)
4947
assert_equal [Govspeak::Header.new("Heading 2", 2, "heading-2")], headers
5048
end
5149

52-
it "should extract header hierarchy from level 2+3 headings" do
50+
test "should extract header hierarchy from level 2+3 headings" do
5351
text = "# Heading 1\n\n## Heading 2a\n\n### Heading 3a\n\n### Heading 3b\n\n#### Ignored heading\n\n## Heading 2b"
5452
headers = govspeak_header_hierarchy(text)
5553
assert_equal [
@@ -68,18 +66,18 @@ class GovspeakPreviewHelperTest < ActionView::TestCase
6866
headers
6967
end
7068

71-
it "should raise exception when extracting header hierarchy with orphaned level 3 headings" do
69+
test "should raise exception when extracting header hierarchy with orphaned level 3 headings" do
7270
e = assert_raise(Govspeak::OrphanedHeadingError) { govspeak_header_hierarchy("### Heading 3") }
7371
assert_equal "Heading 3", e.heading
7472
end
7573

76-
it "adds numbers to h2 headings" do
74+
test "adds numbers to h2 headings" do
7775
input = "# main\n\n## first\n\n## second"
7876
output = '<div class="govspeak"><h1 id="main">main</h1> <h2 id="first"> <span class="number">1. </span>first</h2> <h2 id="second"> <span class="number">2. </span>second</h2></div>'
7977
assert_equivalent_html output, govspeak_to_html(input, heading_numbering: :auto).gsub(/\s+/, " ")
8078
end
8179

82-
it "adds sub-numbers to h3 tags" do
80+
test "adds sub-numbers to h3 tags" do
8381
input = "## first\n\n### first point one\n\n### first point two\n\n## second\n\n### second point one"
8482
expected_output1 = '<h2 id="first"> <span class="number">1. </span>first</h2>'
8583
expected_output_1a = '<h3 id="first-point-one"> <span class="number">1.1 </span>first point one</h3>'
@@ -94,29 +92,27 @@ class GovspeakPreviewHelperTest < ActionView::TestCase
9492
assert_match %r{#{expected_output_2a}}, actual_output
9593
end
9694

97-
it "should not corrupt character encoding of numbered headings" do
95+
test "should not corrupt character encoding of numbered headings" do
9896
input = "# café"
9997
actual_output = govspeak_to_html(input, heading_numbering: :auto)
10098
assert actual_output.include?("café</h1>")
10199
end
102100

103-
describe "admin flavour of govspeak" do
104-
it "should wrap admin output with a govspeak class" do
105-
html = govspeak_to_html("govspeak-text", { preview: true })
106-
assert_select_within_html html, ".govspeak", text: "govspeak-text"
107-
end
101+
test "should wrap admin output with a govspeak class" do
102+
html = govspeak_to_html("govspeak-text", { preview: true })
103+
assert_select_within_html html, ".govspeak", text: "govspeak-text"
104+
end
108105

109-
it "should mark the admin govspeak output as html safe" do
110-
html = govspeak_to_html("govspeak-text", { preview: true })
111-
assert html.html_safe?
112-
end
106+
test "should mark the admin govspeak output as html safe" do
107+
html = govspeak_to_html("govspeak-text", { preview: true })
108+
assert html.html_safe?
109+
end
113110

114-
it "should call the embed codes helper" do
115-
input = "Here is some Govspeak"
116-
expected = "Expected output"
117-
ContentBlockManager::FindAndReplaceEmbedCodesService.expects(:call).with(input).returns(expected)
118-
govspeak_to_html(input, { preview: true })
119-
end
111+
test "should call the embed codes helper" do
112+
input = "Here is some Govspeak"
113+
expected = "Expected output"
114+
ContentBlockManager::FindAndReplaceEmbedCodesService.expects(:call).with(input).returns(expected)
115+
govspeak_to_html(input, { preview: true })
120116
end
121117

122118
private

0 commit comments

Comments
 (0)