diff --git a/spec/controllers/topics_controller_spec.rb b/spec/controllers/topics_controller_spec.rb index 8b31305eef4..fd927ebac3f 100644 --- a/spec/controllers/topics_controller_spec.rb +++ b/spec/controllers/topics_controller_spec.rb @@ -295,9 +295,9 @@ describe TopicsController do it 'should update the timestamps of selected posts' do xhr :put, :change_timestamps, topic_id: topic.id, timestamp: new_timestamp.to_f - expect(topic.reload.created_at.to_s).to eq(new_timestamp.to_s) - expect(p1.reload.created_at.to_s).to eq(new_timestamp.to_s) - expect(p2.reload.created_at.to_s).to eq(old_timestamp.to_s) + expect(topic.reload.created_at).to be_within_one_second_of(new_timestamp) + expect(p1.reload.created_at).to be_within_one_second_of(new_timestamp) + expect(p2.reload.created_at).to be_within_one_second_of(old_timestamp) end end end