mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
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:

committed by
Loïc Guitaut

parent
8e1d049e6b
commit
0f4beab0fb
@ -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
|
||||
|
Reference in New Issue
Block a user