brew/Library/Homebrew/test/rubocops/cask/homepage_url_styling_spec.rb

37 lines
881 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::HomepageUrlStyling, :config do
2023-05-08 11:02:44 +02:00
it "accepts a homepage URL ending with a slash" do
expect_no_offenses <<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
CASK
end
2023-05-08 11:02:44 +02:00
it "accepts a homepage URL with a path" do
expect_no_offenses <<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/path'
end
CASK
end
2023-05-08 11:02:44 +02:00
it "reports an offense when the homepage URL does not end with a slash and has no path" do
expect_offense <<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh'
^^^^^^^^^^^^^^^^^^^^^ 'https://foo.brew.sh' must have a slash after the domain.
end
CASK
expect_correction <<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
CASK
end
end