fix timestamp comparison in spec that can fail

This commit is contained in:
Neil Lalonde 2015-08-21 17:21:20 -04:00
parent d8d18ee0c3
commit 58190c92e9
1 changed files with 3 additions and 3 deletions

View File

@ -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