Skip to content

Commit

Permalink
Merge pull request #381 from alphagov/failing-ci
Browse files Browse the repository at this point in the history
Fix CI (bumping minimum versions of Ruby and govuk_publishing_components)
  • Loading branch information
mike3985 authored Jan 27, 2025
2 parents c5c77c8 + 7eee479 commit 534ce41
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [3.1, 3.2, 3.3]
ruby: [3.2, 3.3]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.2.2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 10.0.0

* Drop support for Ruby <3.2
* Drop support for govuk_publishing_components <43.0.0

## 9.0.0

* Remove Advisory component ([#357](https://github.com/alphagov/govspeak/pull/357))
Expand Down
4 changes: 2 additions & 2 deletions govspeak.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.summary = "Markup language for single domain"
s.description = 'A set of extensions to markdown layered on top of the kramdown
library for use in the UK Government Single Domain project'
s.required_ruby_version = ">= 3.1.4"
s.required_ruby_version = ">= 3.2"

s.files = Dir[
"lib/**/*",
Expand All @@ -31,7 +31,7 @@ library for use in the UK Government Single Domain project'

s.add_dependency "actionview", ">= 6", "< 8.0.2"
s.add_dependency "addressable", ">= 2.3.8", "< 2.8.8"
s.add_dependency "govuk_publishing_components", ">= 35.1"
s.add_dependency "govuk_publishing_components", ">= 43"
s.add_dependency "htmlentities", "~> 4"
s.add_dependency "i18n", ">= 0.7", "< 1.14.7"
s.add_dependency "kramdown", ">= 2.3.1", "< 2.5.2"
Expand Down
2 changes: 1 addition & 1 deletion lib/govspeak/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Govspeak
VERSION = "9.0.0".freeze
VERSION = "10.0.0".freeze
end
8 changes: 4 additions & 4 deletions test/govspeak_attachment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def render_govspeak(govspeak, attachments = [])
}

rendered = render_govspeak("[Attachment:attachment.pdf]", [attachment])
assert_match(/<section class="gem-c-attachment/, rendered)
assert html_has_selector?(rendered, "section.gem-c-attachment")
assert_match(/Attachment Title/, rendered)
end

Expand All @@ -29,7 +29,7 @@ def render_govspeak(govspeak, attachments = [])
}

rendered = render_govspeak("[Attachment: This is the name of my &%$@€? attachment]", [attachment])
assert_match(/<section class="gem-c-attachment/, rendered)
assert html_has_selector?(rendered, "section.gem-c-attachment")
assert_match(/Attachment Title/, rendered)
end

Expand All @@ -44,12 +44,12 @@ def render_govspeak(govspeak, attachments = [])
assert_equal("<p>some text [Attachment:attachment.pdf]</p>\n", rendered)

rendered = render_govspeak("[Attachment:attachment.pdf] some text", [attachment])
assert_match(/<section class="gem-c-attachment/, rendered)
assert html_has_selector?(rendered, "section.gem-c-attachment")
assert_match(/<p>some text<\/p>/, rendered)

rendered = render_govspeak("some text\n[Attachment:attachment.pdf]\nsome more text", [attachment])
assert_match(/<p>some text<\/p>/, rendered)
assert_match(/<section class="gem-c-attachment/, rendered)
assert html_has_selector?(rendered, "section.gem-c-attachment")
assert_match(/<p>some more text<\/p>/, rendered)
end
end
10 changes: 10 additions & 0 deletions test/support/html_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module HtmlHelpers
def html_has_selector?(html_string, selector)
return false if html_string.nil? || html_string.empty?

raise "No selector specified" if selector.nil? || selector.empty?

fragment = Nokogiri::HTML.fragment(html_string)
fragment.css(selector).any?
end
end
4 changes: 4 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

require "minitest/autorun"

require "support/html_helpers"

class Minitest::Test
include HtmlHelpers

class << self
def test(name, &block)
clean_name = name.gsub(/\s+/, "_")
Expand Down

0 comments on commit 534ce41

Please sign in to comment.