govspeak 6.5.0 → 6.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,15 +34,15 @@ module Govspeak
34
34
  def attachment_attributes
35
35
  attributes = []
36
36
  if file_extension == "html"
37
- attributes << content_tag(:span, 'HTML', class: 'type')
37
+ attributes << content_tag(:span, "HTML", class: "type")
38
38
  elsif attachment[:external?]
39
- attributes << content_tag(:span, url, class: 'url')
39
+ attributes << content_tag(:span, url, class: "url")
40
40
  else
41
- attributes << content_tag(:span, humanized_content_type(file_extension), class: 'type') if file_extension
42
- attributes << content_tag(:span, number_to_human_size(attachment[:file_size]), class: 'file-size') if attachment[:file_size]
43
- attributes << content_tag(:span, pluralize(attachment[:number_of_pages], "page"), class: 'page-length') if attachment[:number_of_pages]
41
+ attributes << content_tag(:span, humanized_content_type(file_extension), class: "type") if file_extension
42
+ attributes << content_tag(:span, number_to_human_size(attachment[:file_size]), class: "file-size") if attachment[:file_size]
43
+ attributes << content_tag(:span, pluralize(attachment[:number_of_pages], "page"), class: "page-length") if attachment[:number_of_pages]
44
44
  end
45
- attributes.join(', ').html_safe
45
+ attributes.join(", ").html_safe
46
46
  end
47
47
 
48
48
  MS_WORD_DOCUMENT_HUMANIZED_CONTENT_TYPE = "MS Word Document".freeze
@@ -55,41 +55,41 @@ module Govspeak
55
55
 
56
56
  def humanized_content_type(file_extension)
57
57
  file_extension_vs_humanized_content_type = {
58
- "chm" => file_abbr_tag('CHM', 'Microsoft Compiled HTML Help'),
59
- "csv" => file_abbr_tag('CSV', 'Comma-separated Values'),
60
- "diff" => file_abbr_tag('DIFF', 'Plain text differences'),
58
+ "chm" => file_abbr_tag("CHM", "Microsoft Compiled HTML Help"),
59
+ "csv" => file_abbr_tag("CSV", "Comma-separated Values"),
60
+ "diff" => file_abbr_tag("DIFF", "Plain text differences"),
61
61
  "doc" => MS_WORD_DOCUMENT_HUMANIZED_CONTENT_TYPE,
62
62
  "docx" => MS_WORD_DOCUMENT_HUMANIZED_CONTENT_TYPE,
63
- "dot" => file_abbr_tag('DOT', 'MS Word Document Template'),
64
- "dxf" => file_abbr_tag('DXF', 'AutoCAD Drawing Exchange Format'),
65
- "eps" => file_abbr_tag('EPS', 'Encapsulated PostScript'),
66
- "gif" => file_abbr_tag('GIF', 'Graphics Interchange Format'),
67
- "gml" => file_abbr_tag('GML', 'Geography Markup Language'),
68
- "html" => file_abbr_tag('HTML', 'Hypertext Markup Language'),
69
- "ics" => file_abbr_tag('ICS', 'iCalendar file'),
63
+ "dot" => file_abbr_tag("DOT", "MS Word Document Template"),
64
+ "dxf" => file_abbr_tag("DXF", "AutoCAD Drawing Exchange Format"),
65
+ "eps" => file_abbr_tag("EPS", "Encapsulated PostScript"),
66
+ "gif" => file_abbr_tag("GIF", "Graphics Interchange Format"),
67
+ "gml" => file_abbr_tag("GML", "Geography Markup Language"),
68
+ "html" => file_abbr_tag("HTML", "Hypertext Markup Language"),
69
+ "ics" => file_abbr_tag("ICS", "iCalendar file"),
70
70
  "jpg" => "JPEG",
71
- "odp" => file_abbr_tag('ODP', 'OpenDocument Presentation'),
72
- "ods" => file_abbr_tag('ODS', 'OpenDocument Spreadsheet'),
73
- "odt" => file_abbr_tag('ODT', 'OpenDocument Text document'),
74
- "pdf" => file_abbr_tag('PDF', 'Portable Document Format'),
75
- "png" => file_abbr_tag('PNG', 'Portable Network Graphic'),
71
+ "odp" => file_abbr_tag("ODP", "OpenDocument Presentation"),
72
+ "ods" => file_abbr_tag("ODS", "OpenDocument Spreadsheet"),
73
+ "odt" => file_abbr_tag("ODT", "OpenDocument Text document"),
74
+ "pdf" => file_abbr_tag("PDF", "Portable Document Format"),
75
+ "png" => file_abbr_tag("PNG", "Portable Network Graphic"),
76
76
  "ppt" => MS_POWERPOINT_PRESENTATION_HUMANIZED_CONTENT_TYPE,
77
77
  "pptx" => MS_POWERPOINT_PRESENTATION_HUMANIZED_CONTENT_TYPE,
78
- "ps" => file_abbr_tag('PS', 'PostScript'),
79
- "rdf" => file_abbr_tag('RDF', 'Resource Description Framework'),
80
- "rtf" => file_abbr_tag('RTF', 'Rich Text Format'),
81
- "sch" => file_abbr_tag('SCH', 'XML based Schematic'),
78
+ "ps" => file_abbr_tag("PS", "PostScript"),
79
+ "rdf" => file_abbr_tag("RDF", "Resource Description Framework"),
80
+ "rtf" => file_abbr_tag("RTF", "Rich Text Format"),
81
+ "sch" => file_abbr_tag("SCH", "XML based Schematic"),
82
82
  "txt" => "Plain text",
83
- "wsdl" => file_abbr_tag('WSDL', 'Web Services Description Language'),
83
+ "wsdl" => file_abbr_tag("WSDL", "Web Services Description Language"),
84
84
  "xls" => MS_EXCEL_SPREADSHEET_HUMANIZED_CONTENT_TYPE,
85
- "xlsm" => file_abbr_tag('XLSM', 'MS Excel Macro-Enabled Workbook'),
85
+ "xlsm" => file_abbr_tag("XLSM", "MS Excel Macro-Enabled Workbook"),
86
86
  "xlsx" => MS_EXCEL_SPREADSHEET_HUMANIZED_CONTENT_TYPE,
87
- "xlt" => file_abbr_tag('XLT', 'MS Excel Spreadsheet Template'),
88
- "xsd" => file_abbr_tag('XSD', 'XML Schema'),
89
- "xslt" => file_abbr_tag('XSLT', 'Extensible Stylesheet Language Transformation'),
90
- "zip" => file_abbr_tag('ZIP', 'Zip archive'),
87
+ "xlt" => file_abbr_tag("XLT", "MS Excel Spreadsheet Template"),
88
+ "xsd" => file_abbr_tag("XSD", "XML Schema"),
89
+ "xslt" => file_abbr_tag("XSLT", "Extensible Stylesheet Language Transformation"),
90
+ "zip" => file_abbr_tag("ZIP", "Zip archive"),
91
91
  }
92
- file_extension_vs_humanized_content_type.fetch(file_extension.to_s.downcase, '')
92
+ file_extension_vs_humanized_content_type.fetch(file_extension.to_s.downcase, "")
93
93
  end
94
94
 
95
95
  def link(body, url, options = {})
@@ -1,5 +1,5 @@
1
- require 'active_support/core_ext/array'
2
- require 'active_support/core_ext/hash'
1
+ require "active_support/core_ext/array"
2
+ require "active_support/core_ext/hash"
3
3
 
4
4
  module Govspeak
5
5
  class ContactPresenter
@@ -2,7 +2,7 @@ module Govspeak
2
2
  class HCardPresenter
3
3
  def self.address_formats
4
4
  @address_formats ||= YAML.load_file(
5
- File.expand_path('config/address_formats.yml', Govspeak.root)
5
+ File.expand_path("config/address_formats.yml", Govspeak.root),
6
6
  )
7
7
  end
8
8
 
@@ -44,7 +44,7 @@ module Govspeak
44
44
  address.gsub!(/\{\{#{hcard_name}\}\}/, interpolate_address_property(our_name, hcard_name))
45
45
  end
46
46
 
47
- address.gsub(/^\n/, '') # get rid of blank lines
47
+ address.gsub(/^\n/, "") # get rid of blank lines
48
48
  .strip # get rid of any trailing whitespace
49
49
  .gsub(/\n/, "<br />\n") # add break tags where appropriate
50
50
  end
@@ -55,7 +55,7 @@ module Govspeak
55
55
  end
56
56
 
57
57
  def default_format_string
58
- self.class.address_formats['gb']
58
+ self.class.address_formats["gb"]
59
59
  end
60
60
  end
61
61
  end
@@ -32,10 +32,10 @@ module Govspeak
32
32
 
33
33
  def figcaption_html
34
34
  lines = []
35
- lines << '<figcaption>'
35
+ lines << "<figcaption>"
36
36
  lines << %{<p>#{caption}</p>} if caption.present?
37
37
  lines << %{<p>#{I18n.t('govspeak.image.figure.credit', credit: credit)}</p>} if credit.present?
38
- lines << '</figcaption>'
38
+ lines << "</figcaption>"
39
39
  lines.join
40
40
  end
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "6.5.0".freeze
2
+ VERSION = "6.5.1".freeze
3
3
  end
@@ -33,7 +33,7 @@ module Kramdown
33
33
  begin
34
34
  host = Addressable::URI.parse(href).host
35
35
  unless host.nil? || @document_domains.compact.include?(host)
36
- element.attr['rel'] = 'external'
36
+ element.attr["rel"] = "external"
37
37
  end
38
38
  # rubocop:disable Lint/HandleExceptions
39
39
  rescue Addressable::URI::InvalidURIError
@@ -28,67 +28,67 @@ class BlockquoteExtraQuoteRemoverTest < Minitest::Test
28
28
  test "transforms text with surrounding quotes" do
29
29
  assert_remover_transforms(
30
30
  %{He said:\n> "yes, it's true!"\n\napparently.} =>
31
- %{He said:\n> yes, it's true!\n\napparently.}
31
+ %{He said:\n> yes, it's true!\n\napparently.},
32
32
  )
33
33
  end
34
34
 
35
35
  test "leaves quotes in the middle of the string" do
36
36
  assert_remover_transforms(
37
37
  %{He said:\n> "yes, it's true!" whilst sipping a cocktail. "And yes, I did rather enjoy it." \n\napparently.} =>
38
- %{He said:\n> yes, it's true!" whilst sipping a cocktail. "And yes, I did rather enjoy it.\n\napparently.}
38
+ %{He said:\n> yes, it's true!" whilst sipping a cocktail. "And yes, I did rather enjoy it.\n\napparently.},
39
39
  )
40
40
  end
41
41
 
42
42
  test "leaves trailing text and quote intact" do
43
43
  assert_remover_transforms(
44
44
  %{He said:\n> "yes, it's true!" whilst sipping a cocktail.} =>
45
- %{He said:\n> yes, it's true!" whilst sipping a cocktail.}
45
+ %{He said:\n> yes, it's true!" whilst sipping a cocktail.},
46
46
  )
47
47
  end
48
48
 
49
49
  test "windows line breaks" do
50
50
  assert_remover_transforms(
51
51
  %{Sir George Young MP, said\r\n> "I welcome the positive public response to the e-petitions site, which is important way of building a bridge between people and Parliament.”\r\n## The special relationship} =>
52
- %{Sir George Young MP, said\r\n> I welcome the positive public response to the e-petitions site, which is important way of building a bridge between people and Parliament.\r\n## The special relationship}
52
+ %{Sir George Young MP, said\r\n> I welcome the positive public response to the e-petitions site, which is important way of building a bridge between people and Parliament.\r\n## The special relationship},
53
53
  )
54
54
  end
55
55
 
56
56
  test "no space in front" do
57
57
  assert_remover_transforms(
58
58
  %{>"As we continue with the redundancy process we will ensure we retain the capabilities that our armed forces will require to meet the challenges of the future. The redundancy programme will not impact adversely on the current operations in Afghanistan, where our armed forces continue to fight so bravely on this country's behalf."} =>
59
- %{> As we continue with the redundancy process we will ensure we retain the capabilities that our armed forces will require to meet the challenges of the future. The redundancy programme will not impact adversely on the current operations in Afghanistan, where our armed forces continue to fight so bravely on this country's behalf.}
59
+ %{> As we continue with the redundancy process we will ensure we retain the capabilities that our armed forces will require to meet the challenges of the future. The redundancy programme will not impact adversely on the current operations in Afghanistan, where our armed forces continue to fight so bravely on this country's behalf.},
60
60
  )
61
61
  end
62
62
 
63
63
  test "handles space after a quote" do
64
64
  assert_remover_transforms(
65
65
  %{>" Test"} =>
66
- %{> Test}
66
+ %{> Test},
67
67
  )
68
68
  end
69
69
 
70
70
  test "remove double double quotes" do
71
71
  assert_remover_transforms(
72
72
  %{We heard it said:\n\n> ""Today the coalition is remedying those deficiencies by putting in place a new fast track process where the people's elected representatives have responsibility for the final decisions about Britain's future instead of unelected commissioners.""} =>
73
- %{We heard it said:\n\n> Today the coalition is remedying those deficiencies by putting in place a new fast track process where the people's elected representatives have responsibility for the final decisions about Britain's future instead of unelected commissioners.}
73
+ %{We heard it said:\n\n> Today the coalition is remedying those deficiencies by putting in place a new fast track process where the people's elected representatives have responsibility for the final decisions about Britain's future instead of unelected commissioners.},
74
74
  )
75
75
  assert_remover_transforms(
76
76
  %{> ""Today the coalition is remedying those deficiencies by putting in place a new fast track process where the people's elected representatives have responsibility for the final decisions about Britain's future instead of unelected commissioners.} =>
77
- %{> Today the coalition is remedying those deficiencies by putting in place a new fast track process where the people's elected representatives have responsibility for the final decisions about Britain's future instead of unelected commissioners.}
77
+ %{> Today the coalition is remedying those deficiencies by putting in place a new fast track process where the people's elected representatives have responsibility for the final decisions about Britain's future instead of unelected commissioners.},
78
78
  )
79
79
  end
80
80
 
81
81
  test "removes quotes correctly from multi-line blockquotes" do
82
82
  assert_remover_transforms(
83
83
  %{> "Here is a block quote using 2 lines and two of the arrows.\n> I am not sure how this will render. I think it will mash them together."} =>
84
- %{> Here is a block quote using 2 lines and two of the arrows.\n> I am not sure how this will render. I think it will mash them together.}
84
+ %{> Here is a block quote using 2 lines and two of the arrows.\n> I am not sure how this will render. I think it will mash them together.},
85
85
  )
86
86
  end
87
87
 
88
88
  test "preserves multiline blockquotes with plain newlines quotes" do
89
89
  assert_remover_transforms(
90
90
  %{> "line 1\n> \n> "line 2\n> \n> "line 3"} =>
91
- %{> line 1\n> \n> line 2\n> \n> line 3}
91
+ %{> line 1\n> \n> line 2\n> \n> line 3},
92
92
  )
93
93
  end
94
94
 
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'test_helper'
3
+ require "test_helper"
4
4
 
5
5
  class GovspeakAttachmentsImageTest < Minitest::Test
6
6
  def build_attachment(args = {})
@@ -17,7 +17,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
17
17
  end
18
18
 
19
19
  def compress_html(html)
20
- html.gsub(/[\n\r]+[\s]*/, '')
20
+ html.gsub(/[\n\r]+[\s]*/, "")
21
21
  end
22
22
 
23
23
  test "renders an empty string for an image attachment not found" do
@@ -27,7 +27,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
27
27
  test "wraps an attachment in a figure with the id if the id is present" do
28
28
  rendered = render_govspeak(
29
29
  "[embed:attachments:image:1fe8]",
30
- [build_attachment(id: 10, content_id: "1fe8")]
30
+ [build_attachment(id: 10, content_id: "1fe8")],
31
31
  )
32
32
  assert_match(/<figure id="attachment_10" class="image embedded">/, rendered)
33
33
  end
@@ -35,7 +35,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
35
35
  test "wraps an attachment in a figure without the id if the id is not present" do
36
36
  rendered = render_govspeak(
37
37
  "[embed:attachments:image:1fe8]",
38
- [build_attachment(id: nil, content_id: "1fe8")]
38
+ [build_attachment(id: nil, content_id: "1fe8")],
39
39
  )
40
40
  assert_match(/<figure class="image embedded">/, rendered)
41
41
  end
@@ -43,7 +43,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
43
43
  test "renders an attachment if there are spaces around the content_id" do
44
44
  rendered = render_govspeak(
45
45
  "[embed:attachments:image: 1fe8 ]",
46
- [build_attachment(id: 10, content_id: "1fe8")]
46
+ [build_attachment(id: 10, content_id: "1fe8")],
47
47
  )
48
48
  assert_match(/<figure id="attachment_10" class="image embedded">/, rendered)
49
49
  end
@@ -51,7 +51,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
51
51
  test "has an image element to the file" do
52
52
  rendered = render_govspeak(
53
53
  "[embed:attachments:image:1fe8]",
54
- [build_attachment(id: nil, url: "http://a.b/c.jpg", content_id: "1fe8")]
54
+ [build_attachment(id: nil, url: "http://a.b/c.jpg", content_id: "1fe8")],
55
55
  )
56
56
  assert_match(%r{<img.*src="http://a.b/c.jpg"}, rendered)
57
57
  end
@@ -59,7 +59,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
59
59
  test "renders the image title as an alt tag" do
60
60
  rendered = render_govspeak(
61
61
  "[embed:attachments:image:1fe8]",
62
- [build_attachment(id: nil, title: "My Title", content_id: "1fe8")]
62
+ [build_attachment(id: nil, title: "My Title", content_id: "1fe8")],
63
63
  )
64
64
  assert_match(%r{<img.*alt="My Title"}, rendered)
65
65
  end
@@ -67,7 +67,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
67
67
  test "can render a nil image title" do
68
68
  rendered = render_govspeak(
69
69
  "[embed:attachments:image:1fe8]",
70
- [build_attachment(id: nil, title: nil, content_id: "1fe8")]
70
+ [build_attachment(id: nil, title: nil, content_id: "1fe8")],
71
71
  )
72
72
  assert_match(%r{<img.*alt=""}, rendered)
73
73
  end
@@ -75,7 +75,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
75
75
  test "a full image attachment rendering looks correct" do
76
76
  rendered = render_govspeak(
77
77
  "[embed:attachments:image:1fe8]",
78
- [build_attachment(id: 10, url: "http://a.b/c.jpg", title: "My Title", content_id: "1fe8")]
78
+ [build_attachment(id: 10, url: "http://a.b/c.jpg", title: "My Title", content_id: "1fe8")],
79
79
  )
80
80
  expected_html_output = %{
81
81
  <figure id="attachment_10" class="image embedded">
@@ -89,7 +89,7 @@ class GovspeakAttachmentsImageTest < Minitest::Test
89
89
  test "can be rendered inside a table" do
90
90
  rendered = render_govspeak(
91
91
  "| [embed:attachments:image:1fe8] |",
92
- [build_attachment(content_id: "1fe8", id: nil)]
92
+ [build_attachment(content_id: "1fe8", id: nil)],
93
93
  )
94
94
 
95
95
  regex = %r{<td><figure class="image embedded"><div class="img">(.*?)</div></figure></td>}
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'test_helper'
3
+ require "test_helper"
4
4
 
5
5
  class GovspeakAttachmentsInlineTest < Minitest::Test
6
6
  def build_attachment(args = {})
@@ -23,7 +23,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
23
23
  test "wraps an attachment in a span with the id if the id is present" do
24
24
  rendered = render_govspeak(
25
25
  "[embed:attachments:inline:1fe8]",
26
- [build_attachment(id: 10, content_id: "1fe8")]
26
+ [build_attachment(id: 10, content_id: "1fe8")],
27
27
  )
28
28
  assert_match(/<span id="attachment_10" class="attachment-inline">/, rendered)
29
29
  end
@@ -31,7 +31,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
31
31
  test "wraps an attachment in a span without the id if the id is not present" do
32
32
  rendered = render_govspeak(
33
33
  "[embed:attachments:inline:1fe8]",
34
- [build_attachment(id: nil, content_id: "1fe8")]
34
+ [build_attachment(id: nil, content_id: "1fe8")],
35
35
  )
36
36
  assert_match(/<span class="attachment-inline">/, rendered)
37
37
  end
@@ -39,7 +39,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
39
39
  test "renders an attachment where the content id has spaces" do
40
40
  rendered = render_govspeak(
41
41
  "[embed:attachments:inline: 1fe8 ]",
42
- [build_attachment(id: nil, content_id: "1fe8")]
42
+ [build_attachment(id: nil, content_id: "1fe8")],
43
43
  )
44
44
  assert_match(/<span class="attachment-inline">/, rendered)
45
45
  end
@@ -47,7 +47,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
47
47
  test "links to the attachment file" do
48
48
  rendered = render_govspeak(
49
49
  "[embed:attachments:inline:1fe8]",
50
- [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", title: "My Pdf")]
50
+ [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", title: "My Pdf")],
51
51
  )
52
52
  assert_match(%r{<a href="http://a.b/f.pdf">My Pdf</a>}, rendered)
53
53
  end
@@ -55,7 +55,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
55
55
  test "renders with a nil title" do
56
56
  rendered = render_govspeak(
57
57
  "[embed:attachments:inline:1fe8]",
58
- [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", title: nil)]
58
+ [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", title: nil)],
59
59
  )
60
60
  assert_match(%r{<a href="http://a.b/f.pdf"></a>}, rendered)
61
61
  end
@@ -63,7 +63,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
63
63
  test "renders on a single line" do
64
64
  rendered = render_govspeak(
65
65
  "[embed:attachments:inline:2bc1]",
66
- [build_attachment(content_id: "2bc1", external?: true)]
66
+ [build_attachment(content_id: "2bc1", external?: true)],
67
67
  )
68
68
  assert_match(%r{<span id="attachment[^\n]*</span>}, rendered)
69
69
  end
@@ -71,7 +71,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
71
71
  test "doesn't have spaces between the span and the link" do
72
72
  rendered = render_govspeak(
73
73
  "[embed:attachments:inline:2bc1]",
74
- [build_attachment(content_id: "2bc1", id: nil)]
74
+ [build_attachment(content_id: "2bc1", id: nil)],
75
75
  )
76
76
  assert_match(%r{<span class="attachment-inline"><a href=".*">.*</a></span>}, rendered)
77
77
  end
@@ -79,7 +79,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
79
79
  test "will show HTML type (in brackets) if file_extension is specified as html" do
80
80
  rendered = render_govspeak(
81
81
  "[embed:attachments:inline:1fe8]",
82
- [build_attachment(content_id: "1fe8", file_extension: "html")]
82
+ [build_attachment(content_id: "1fe8", file_extension: "html")],
83
83
  )
84
84
  assert_match(%r{(<span class="type">HTML</span>)}, rendered)
85
85
  end
@@ -87,7 +87,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
87
87
  test "will show url (in brackets) if specified as external" do
88
88
  rendered = render_govspeak(
89
89
  "[embed:attachments:inline:1fe8]",
90
- [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", external?: true)]
90
+ [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", external?: true)],
91
91
  )
92
92
  assert_match(%r{(<span class="url">http://a.b/f.pdf</span>)}, rendered)
93
93
  end
@@ -95,7 +95,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
95
95
  test "will not show url if file_extension is specified as html" do
96
96
  rendered = render_govspeak(
97
97
  "[embed:attachments:inline:1fe8]",
98
- [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", file_extension: "html", external?: true)]
98
+ [build_attachment(content_id: "1fe8", url: "http://a.b/f.pdf", file_extension: "html", external?: true)],
99
99
  )
100
100
  refute_match(%r{(<span class="url">http://a.b/f.pdf</span>)}, rendered)
101
101
  end
@@ -103,7 +103,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
103
103
  test "will show a file extension in a abbr element for non html" do
104
104
  rendered = render_govspeak(
105
105
  "[embed:attachments:inline:1fe8]",
106
- [build_attachment(content_id: "1fe8", file_extension: "csv")]
106
+ [build_attachment(content_id: "1fe8", file_extension: "csv")],
107
107
  )
108
108
  refute_match(%r{<span class="type"><abbr title="Comma-separated values">CSV</abbr></span>}, rendered)
109
109
  end
@@ -111,7 +111,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
111
111
  test "will show file size in a span" do
112
112
  rendered = render_govspeak(
113
113
  "[embed:attachments:inline:1fe8]",
114
- [build_attachment(content_id: "1fe8", file_size: 1024)]
114
+ [build_attachment(content_id: "1fe8", file_size: 1024)],
115
115
  )
116
116
  assert_match(%r{<span class="file-size">1 KB</span>}, rendered)
117
117
  end
@@ -119,12 +119,12 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
119
119
  test "will show number of pages" do
120
120
  rendered = render_govspeak(
121
121
  "[embed:attachments:inline:1fe8]",
122
- [build_attachment(content_id: "1fe8", number_of_pages: 1)]
122
+ [build_attachment(content_id: "1fe8", number_of_pages: 1)],
123
123
  )
124
124
  assert_match(%r{<span class="page-length">1 page</span>}, rendered)
125
125
  rendered = render_govspeak(
126
126
  "[embed:attachments:inline:1fe8]",
127
- [build_attachment(content_id: "1fe8", number_of_pages: 2)]
127
+ [build_attachment(content_id: "1fe8", number_of_pages: 2)],
128
128
  )
129
129
  assert_match(%r{<span class="page-length">2 pages</span>}, rendered)
130
130
  end
@@ -139,7 +139,7 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
139
139
  file_extension: "txt",
140
140
  file_size: 2048,
141
141
  number_of_pages: 2,
142
- )]
142
+ )],
143
143
  )
144
144
  link = %{<a href="#{Regexp.quote('http://a.b/test.txt')}">My Attached Text File</a>}
145
145
  type = %{<span class="type">Plain text</span>}
@@ -153,8 +153,8 @@ class GovspeakAttachmentsInlineTest < Minitest::Test
153
153
  "[embed:attachments:inline:1fe8] and [embed:attachments:inline:2abc]",
154
154
  [
155
155
  build_attachment(content_id: "1fe8", url: "http://a.b/test.txt", title: "Text File"),
156
- build_attachment(content_id: "2abc", url: "http://a.b/test.pdf", title: "PDF File")
157
- ]
156
+ build_attachment(content_id: "2abc", url: "http://a.b/test.pdf", title: "PDF File"),
157
+ ],
158
158
  )
159
159
  assert_match(%r{<a href="http://a.b/test.txt">Text File</a>}, rendered)
160
160
  assert_match(%r{<a href="http://a.b/test.pdf">PDF File</a>}, rendered)