Skip to content

Commit

Permalink
ci: ensure that nokogumbo 2.0.4 and 2.0.5 both work
Browse files Browse the repository at this point in the history
This should ensure that we don't break anybody who has upgraded
Nokogiri but hasn't dropped Nokogumbo yet.

Related to #2204
  • Loading branch information
flavorjones committed Jun 23, 2021
1 parent b022660 commit 28bf202
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion scripts/test-gem-install
Expand Up @@ -38,4 +38,5 @@ rake test

# delete the Gemfile because that's confusing to older versions of rubygems (e.g., bionic32)
rm -f Gemfile Gemfile.lock
./scripts/test-nokogumbo-compatibility
./scripts/test-nokogumbo-compatibility 2.0.4
./scripts/test-nokogumbo-compatibility 2.0.5
20 changes: 15 additions & 5 deletions scripts/test-nokogumbo-compatibility
Expand Up @@ -22,18 +22,26 @@ raise "could not find installed gem" unless gemspec

require "bundler/inline"

nokogumbo_version = if ARGV[0] =~ /\d+\.\d+\.\d+/
ARGV[0]
end

gemfile(true) do
source "https://rubygems.org"
gem "minitest"
gem "minitest-reporters"
gem "nokogiri", "=#{gemspec.version}"
gem "nokogumbo"
if nokogumbo_version
gem "nokogumbo", "=#{nokogumbo_version}"
else
gem "nokogumbo"
end
end

nokogumbo_gemspec = Gem::Specification.find_by_name('nokogumbo')
nokogumbo_gemspec = Gem::Specification.find_by_name("nokogumbo")

require 'nokogumbo'
require 'yaml'
require "nokogumbo"
require "yaml"

if ARGV.include?("-v")
puts "---------- Nokogiri version info ----------"
Expand All @@ -54,6 +62,8 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new])
puts "Testing #{gemspec.full_name} installed in #{gemspec.base_dir}"
describe gemspec.full_name do
it "works" do
assert(Nokogiri::HTML5::Document.parse("<div>ahoy</div>"))
doc = Nokogiri::HTML5::Document.parse("<div>ahoy</div>")
assert(doc)
assert_equal("ahoy", doc.at_css("/html/body/div").text)
end
end

0 comments on commit 28bf202

Please sign in to comment.