Fix flaky listings specs (#3899)
* Fix flaky listings specs * Fix another flaky test
This commit is contained in:
parent
099b188530
commit
77e34a726d
2 changed files with 10 additions and 7 deletions
|
|
@ -15,6 +15,7 @@ RSpec.describe ClassifiedListingTag, type: :liquid_template do
|
|||
)
|
||||
end
|
||||
let(:expired_listing) do
|
||||
datetime = 40.days.ago
|
||||
create(
|
||||
:classified_listing,
|
||||
user_id: user.id,
|
||||
|
|
@ -24,9 +25,9 @@ RSpec.describe ClassifiedListingTag, type: :liquid_template do
|
|||
category: "cfp",
|
||||
tag_list: %w[x y z],
|
||||
organization_id: nil,
|
||||
bumped_at: Time.zone.today - 40,
|
||||
created_at: Time.zone.today - 40,
|
||||
updated_at: Time.zone.today - 40,
|
||||
bumped_at: datetime,
|
||||
created_at: datetime,
|
||||
updated_at: datetime,
|
||||
)
|
||||
end
|
||||
let(:org) { create(:organization) }
|
||||
|
|
@ -60,7 +61,7 @@ RSpec.describe ClassifiedListingTag, type: :liquid_template do
|
|||
<div class="ltag__listing-content">
|
||||
<h3>
|
||||
<a href="/listings/#{listing.category}/#{listing.slug}">
|
||||
#{listing.title}
|
||||
#{CGI.escapeHTML(listing.title)}
|
||||
</a>
|
||||
</h3>
|
||||
<div class="ltag__listing-body">
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ RSpec.describe "ClassifiedListings", type: :request do
|
|||
context "when the user has category and slug params for active listing" do
|
||||
it "shows that direct listing" do
|
||||
get "/listings", params: { category: `#{listing.category}`, slug: `#{listing.slug}` }
|
||||
expect(response.body).to include(listing.title)
|
||||
expect(response.body).to include(CGI.escapeHTML(listing.title))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ RSpec.describe "ClassifiedListings", type: :request do
|
|||
expired_listing.published = false
|
||||
expired_listing.save
|
||||
get "/listings", params: { category: `#{expired_listing.category}`, slug: `#{expired_listing.slug}` }
|
||||
expect(response.body).not_to include(expired_listing.title)
|
||||
expect(response.body).not_to include(CGI.escapeHTML(expired_listing.title))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -396,7 +396,9 @@ RSpec.describe "ClassifiedListings", type: :request do
|
|||
let!(:listing_draft) { create(:classified_listing, user: user, bumped_at: nil, published: false) }
|
||||
let(:organization) { create(:organization) }
|
||||
let!(:org_listing) { create(:classified_listing, user: user, organization: organization) }
|
||||
let!(:org_listing_draft) { create(:classified_listing, user: user, organization: organization, bumped_at: nil, published: false) }
|
||||
let!(:org_listing_draft) do
|
||||
create(:classified_listing, user: user, organization: organization, bumped_at: nil, published: false)
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue