Skip to content

Commit

Permalink
Merge pull request #760 from gjtorikian/ruby-31
Browse files Browse the repository at this point in the history
Lock to >= Ruby 3.1
  • Loading branch information
gjtorikian authored Sep 14, 2022
2 parents 3c1726a + 858fb3c commit cbbde40
Show file tree
Hide file tree
Showing 18 changed files with 260 additions and 265 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Ruby CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read
Expand All @@ -17,8 +20,6 @@ jobs:
matrix:
ruby-version:
- 3.1.0
- 3.0.0
- 2.7.6
experimental: [false]
include:
- ruby-version: head
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Linting

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main

permissions:
contents: read
Expand All @@ -17,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
ruby-version: 3.1
bundler-cache: true
- run: bundle install
- name: Rubocop
Expand Down
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ require:
Naming/FileName:
Enabled: false

RSpec/AnyInstance:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/FilePath:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Enabled: false
2 changes: 1 addition & 1 deletion html-proofer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.executables = ["htmlproofer"]
spec.require_paths = ["lib"]
spec.required_ruby_version = [">= 2.6.0", "< 4.0"]
spec.required_ruby_version = [">= 3.1", "< 4.0"]

spec.metadata = {
"funding_uri" => "https://github.com/sponsors/gjtorikian/",
Expand Down
2 changes: 1 addition & 1 deletion lib/html_proofer/check/images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module HTMLProofer
class Check
class Images < HTMLProofer::Check
SCREEN_SHOT_REGEX = /Screen(?: |%20)Shot(?: |%20)\d+-\d+-\d+(?: |%20)at(?: |%20)\d+.\d+.\d+/.freeze
SCREEN_SHOT_REGEX = /Screen(?: |%20)Shot(?: |%20)\d+-\d+-\d+(?: |%20)at(?: |%20)\d+.\d+.\d+/

def run
@html.css("img, source").each do |node|
Expand Down
36 changes: 17 additions & 19 deletions spec/html-proofer/attribute/url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,46 @@
require "spec_helper"

describe HTMLProofer::Attribute::Url do
before(:each) do
@runner = HTMLProofer::Runner.new("")
end
let(:runner) { HTMLProofer::Runner.new("") }

describe "#ignores_pattern_check" do
it "works for regex patterns" do
@runner.options[:ignore_urls] = [%r{/assets/.*(js|css|png|svg)}]
url = HTMLProofer::Attribute::Url.new(@runner, "/assets/main.js")
expect(url.ignore?).to(eq(true))
runner.options[:ignore_urls] = [%r{/assets/.*(js|css|png|svg)}]
url = described_class.new(runner, "/assets/main.js")
expect(url.ignore?).to(be(true))
end

it "works for string patterns" do
@runner.options[:ignore_urls] = ["/assets/main.js"]
url = HTMLProofer::Attribute::Url.new(@runner, "/assets/main.js")
expect(url.ignore?).to(eq(true))
runner.options[:ignore_urls] = ["/assets/main.js"]
url = described_class.new(runner, "/assets/main.js")
expect(url.ignore?).to(be(true))
end
end

describe "#protocol_relative" do
it "works for protocol relative" do
url = HTMLProofer::Attribute::Url.new(@runner, "//assets/main.js")
expect(url.protocol_relative?).to(eq(true))
url = described_class.new(runner, "//assets/main.js")
expect(url.protocol_relative?).to(be(true))
end

it "works for https://" do
url = HTMLProofer::Attribute::Url.new(@runner, "https://assets/main.js")
expect(url.protocol_relative?).to(eq(false))
url = described_class.new(runner, "https://assets/main.js")
expect(url.protocol_relative?).to(be(false))
end

it "works for http://" do
url = HTMLProofer::Attribute::Url.new(@runner, "http://assets/main.js")
expect(url.protocol_relative?).to(eq(false))
url = described_class.new(runner, "http://assets/main.js")
expect(url.protocol_relative?).to(be(false))
end

it "works for relative internal link" do
url = HTMLProofer::Attribute::Url.new(@runner, "assets/main.js")
expect(url.protocol_relative?).to(eq(false))
url = described_class.new(runner, "assets/main.js")
expect(url.protocol_relative?).to(be(false))
end

it "works for absolute internal link" do
url = HTMLProofer::Attribute::Url.new(@runner, "/assets/main.js")
expect(url.protocol_relative?).to(eq(false))
url = described_class.new(runner, "/assets/main.js")
expect(url.protocol_relative?).to(be(false))
end
end
end
Loading

0 comments on commit cbbde40

Please sign in to comment.