From 2fe36f02d650ac9b737b32d23c03ed6b7a2a0305 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Fri, 19 Sep 2025 22:12:34 +0200 Subject: [PATCH] Fix failing model spec --- spec/models/point_spec.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/models/point_spec.rb b/spec/models/point_spec.rb index eaf3d4ba..a61246f4 100644 --- a/spec/models/point_spec.rb +++ b/spec/models/point_spec.rb @@ -53,11 +53,17 @@ RSpec.describe Point, type: :model do end describe '.not_reverse_geocoded' do - let(:point) { create(:point, country: 'Country', city: 'City') } - let(:point_without_address) { create(:point, city: nil, country: nil) } + let!(:point) { create(:point, country: 'Country', city: 'City', reverse_geocoded_at: Time.current) } + let!(:point_without_address) { create(:point, city: nil, country: nil, reverse_geocoded_at: nil) } it 'returns points without reverse geocoded address' do - expect(described_class.not_reverse_geocoded).to eq([point_without_address]) + # Trigger creation of both points + point + point_without_address + + result = described_class.not_reverse_geocoded + expect(result).to include(point_without_address) + expect(result).not_to include(point) end end end