mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +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
@ -6,32 +6,32 @@ RSpec.describe CommonPasswords do
|
||||
end
|
||||
|
||||
describe "#common_password?" do
|
||||
before { described_class.stubs(:redis).returns(stub_everything) }
|
||||
subject(:common_password) { described_class.common_password? @password }
|
||||
|
||||
subject { described_class.common_password? @password }
|
||||
before { described_class.stubs(:redis).returns(stub_everything) }
|
||||
|
||||
it "returns false if password isn't in the common passwords list" do
|
||||
described_class.stubs(:password_list).returns(stub_everything(include?: false))
|
||||
@password = "uncommonPassword"
|
||||
expect(subject).to eq(false)
|
||||
expect(common_password).to eq(false)
|
||||
end
|
||||
|
||||
it "returns false if password is nil" do
|
||||
described_class.expects(:password_list).never
|
||||
@password = nil
|
||||
expect(subject).to eq(false)
|
||||
expect(common_password).to eq(false)
|
||||
end
|
||||
|
||||
it "returns false if password is blank" do
|
||||
described_class.expects(:password_list).never
|
||||
@password = ""
|
||||
expect(subject).to eq(false)
|
||||
expect(common_password).to eq(false)
|
||||
end
|
||||
|
||||
it "returns true if password is in the common passwords list" do
|
||||
described_class.stubs(:password_list).returns(stub_everything(include?: true))
|
||||
@password = "password"
|
||||
expect(subject).to eq(true)
|
||||
expect(common_password).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user