Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider c5ebea5b rédigé par Benjamin Neff's avatar Benjamin Neff Validation de Steffen van Bergerem
Parcourir les fichiers

Fix randomly failing interacted_at spec

also remove some unnecessary Timecop.return

closes #7060
parent 50e73145
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -31,5 +31,4 @@ Given /^"([^"]*)" has commented a lot on "([^"]*)"$/ do |email, post_text| ...@@ -31,5 +31,4 @@ Given /^"([^"]*)" has commented a lot on "([^"]*)"$/ do |email, post_text|
user.comment!(post, "Comment #{n}") user.comment!(post, "Comment #{n}")
end end
end end
Timecop.return
end end
...@@ -72,8 +72,6 @@ describe EvilQuery::Participation do ...@@ -72,8 +72,6 @@ describe EvilQuery::Participation do
alice.comment!(@status_messageE, "party") alice.comment!(@status_messageE, "party")
end end
Timecop.return
end end
let(:posts) {EvilQuery::Participation.new(alice).posts} let(:posts) {EvilQuery::Participation.new(alice).posts}
......
...@@ -68,11 +68,11 @@ describe Comment, type: :model do ...@@ -68,11 +68,11 @@ describe Comment, type: :model do
describe "interacted_at" do describe "interacted_at" do
it "sets the interacted at of the parent to the created at of the comment" do it "sets the interacted at of the parent to the created at of the comment" do
Timecop.travel(Time.zone.now + 1.minute) Timecop.freeze(Time.zone.now + 1.minute) do
comment = Comment::Generator.new(alice, status_bob, "why so formal?").build
comment = Comment::Generator.new(alice, status_bob, "why so formal?").build comment.save
comment.save expect(status_bob.reload.interacted_at.to_i).to eq(comment.created_at.to_i)
expect(status_bob.reload.interacted_at.to_i).to eq(comment.created_at.to_i) end
end end
end end
......
...@@ -47,9 +47,10 @@ describe Like, type: :model do ...@@ -47,9 +47,10 @@ describe Like, type: :model do
it "doesn't change the interacted at timestamp of the parent" do it "doesn't change the interacted at timestamp of the parent" do
interacted_at = status.reload.interacted_at.to_i interacted_at = status.reload.interacted_at.to_i
Timecop.travel(Time.zone.now + 1.minute) Timecop.travel(Time.zone.now + 1.minute) do
Like::Generator.new(alice, status).build.save Like::Generator.new(alice, status).build.save
expect(status.reload.interacted_at.to_i).to eq(interacted_at) expect(status.reload.interacted_at.to_i).to eq(interacted_at)
end
end end
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter