mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add rubocop-rspec (#9288)
This adds rubocop-rspec, and enables some cops that were either already passing or are passing now, after fixing them in this commit. Some new cops are disabled for now, with annotation: "TODO" or "To be decided". Those either need to be discussed first, or require manual changes, or the number of found and fixed offenses is too large to bundle them up in a single PR. Includes: * DEV: Update rubocop's `TargetRubyVersion` to 2.6 * DEV: Enable RSpec/VoidExpect * DEV: Enable RSpec/SharedContext * DEV: Enable RSpec/EmptyExampleGroup (Removed an obsolete empty spec file) * DEV: Enable RSpec/ItBehavesLike * DEV: Remove RSpec/ScatteredLet (It's too strict, as it doesn't recognize fab! as a let-like) * DEV: Remove RSpec/MultipleExpectations
This commit is contained in:
@@ -120,7 +120,7 @@ describe TopicUploadSecurityManager do
|
||||
end
|
||||
|
||||
it "changes the upload secure status to true and changes the ACL and rebakes the post and sets the access control post" do
|
||||
expect(Post.any_instance.expects(:rebake!).once)
|
||||
Post.any_instance.expects(:rebake!).once
|
||||
subject.run
|
||||
expect(upload3.reload.secure?).to eq(true)
|
||||
expect(upload3.reload.access_control_post).to eq(post4)
|
||||
@@ -146,7 +146,7 @@ describe TopicUploadSecurityManager do
|
||||
end
|
||||
|
||||
it "does not change the upload secure status and does not set the access control post" do
|
||||
expect(Post.any_instance.expects(:rebake!).never)
|
||||
Post.any_instance.expects(:rebake!).never
|
||||
subject.run
|
||||
expect(upload3.reload.secure?).to eq(false)
|
||||
expect(upload3.reload.access_control_post).to eq(nil)
|
||||
@@ -174,14 +174,14 @@ describe TopicUploadSecurityManager do
|
||||
end
|
||||
|
||||
def expect_upload_status_not_to_change
|
||||
expect(Post.any_instance.expects(:rebake!).never)
|
||||
Post.any_instance.expects(:rebake!).never
|
||||
subject.run
|
||||
expect(upload.reload.secure?).to eq(true)
|
||||
expect(upload2.reload.secure?).to eq(true)
|
||||
end
|
||||
|
||||
def expect_upload_status_to_change_and_rebake
|
||||
expect(Post.any_instance.expects(:rebake!).twice)
|
||||
Post.any_instance.expects(:rebake!).twice
|
||||
subject.run
|
||||
expect(upload.reload.secure?).to eq(false)
|
||||
expect(upload2.reload.secure?).to eq(false)
|
||||
|
||||
Reference in New Issue
Block a user