DEV: Update the rubocop-discourse gem

This enables cops related to RSpec `subject`.

See https://github.com/discourse/rubocop-discourse/pull/32
This commit is contained in:
Loïc Guitaut
2023-06-21 16:00:19 +02:00
committed by Loïc Guitaut
parent 8e1d049e6b
commit 0f4beab0fb
129 changed files with 1697 additions and 1506 deletions

View File

@ -25,27 +25,28 @@ RSpec.describe ScreenedUrl do
end
describe "normalize" do
let(:record) { described_class.new(@params) }
subject do
subject(:normalized) do
record.normalize
record
end
let(:record) { described_class.new(@params) }
%w[http:// HTTP:// https:// HTTPS://].each do |prefix|
it "strips #{prefix}" do
@params = valid_params.merge(url: url.gsub("http://", prefix))
expect(subject.url).to eq(url.gsub("http://", ""))
expect(normalized.url).to eq(url.gsub("http://", ""))
end
end
it "strips trailing slash" do
@params = valid_params.merge(url: "silverbullet.in/")
expect(subject.url).to eq("silverbullet.in")
expect(normalized.url).to eq("silverbullet.in")
end
it "strips trailing slashes" do
@params = valid_params.merge(url: "silverbullet.in/buy///")
expect(subject.url).to eq("silverbullet.in/buy")
expect(normalized.url).to eq("silverbullet.in/buy")
end
it "downcases domains" do