Flaky Spec Fix:Remove let_it_be usage from Comment Model Spec (#9529)

This commit is contained in:
Molly Struve 2020-07-26 17:22:51 -05:00 committed by GitHub
parent 4f20555221
commit f84f88f9bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View file

@ -1,9 +1,9 @@
require "rails_helper"
RSpec.describe Comment, type: :model do
let_it_be(:user) { create(:user) }
let_it_be(:article) { create(:article, user: user) }
let_it_be_changeable(:comment) { create(:comment, user: user, commentable: article) }
let(:user) { create(:user) }
let(:article) { create(:article, user: user) }
let(:comment) { create(:comment, user: user, commentable: article) }
include_examples "#sync_reactions_count", :article_comment
@ -255,8 +255,8 @@ RSpec.describe Comment, type: :model do
end
describe ".tree_for" do
let_it_be(:other_comment) { create(:comment, commentable: article, user: user) }
let_it_be(:child_comment) { create(:comment, commentable: article, parent: comment, user: user) }
let!(:other_comment) { create(:comment, commentable: article, user: user) }
let!(:child_comment) { create(:comment, commentable: article, parent: comment, user: user) }
before { comment.update_column(:score, 1) }
@ -326,6 +326,8 @@ RSpec.describe Comment, type: :model do
let!(:user) { create(:user) }
before do
article
comment
# making sure there are no other enqueued jobs from other tests
sidekiq_perform_enqueued_jobs(only: Slack::Messengers::Worker)
end

View file

@ -1,13 +1,13 @@
require "rails_helper"
RSpec.describe "Api::V0::Webhooks", type: :request do
let_it_be_changeable(:user) { create(:user) }
let_it_be_changeable(:webhook) do
let(:user) { create(:user) }
let!(:webhook) do
create(:webhook_endpoint, user: user, target_url: "https://api.example.com/go")
end
describe "GET /api/v0/webhooks" do
let_it_be_readonly(:webhook2) do
let(:webhook2) do
create(:webhook_endpoint, user: user, target_url: "https://api.example.com/webhook")
end
@ -55,6 +55,7 @@ RSpec.describe "Api::V0::Webhooks", type: :request do
end
it "returns json on success" do
webhook2
get api_webhooks_path
expect(response.parsed_body).to include(

Binary file not shown.