-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
homepage_url_trailing_slash_spec.rb
66 lines (56 loc) 路 1.47 KB
/
homepage_url_trailing_slash_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# typed: false
# frozen_string_literal: true
require "rubocops/rubocop-cask"
require "test/rubocops/cask/shared_examples/cask_cop"
describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
include CaskCop
subject(:cop) { described_class.new }
context "when the homepage URL ends with a slash" do
let(:source) do
<<-CASK.undent
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
CASK
end
include_examples "does not report any offenses"
end
context "when the homepage URL does not end with a slash but has a path" do
let(:source) do
<<-CASK.undent
cask 'foo' do
homepage 'https://foo.brew.sh/path'
end
CASK
end
include_examples "does not report any offenses"
end
context "when the homepage URL does not end with a slash and has no path" do
let(:source) do
<<-CASK.undent
cask 'foo' do
homepage 'https://foo.brew.sh'
end
CASK
end
let(:correct_source) do
<<-CASK.undent
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
CASK
end
let(:expected_offenses) do
[{
message: "'https://foo.brew.sh' must have a slash "\
"after the domain.",
severity: :convention,
line: 2,
column: 11,
source: "'https://foo.brew.sh'",
}]
end
include_examples "reports offenses"
include_examples "autocorrects source"
end
end