From 58190c92e90d75eb510cc42d384e60ab3e0bb058 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 21 Aug 2015 17:21:20 -0400 Subject: [PATCH] fix timestamp comparison in spec that can fail --- spec/controllers/topics_controller_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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