test/models/hook_test.rb in shipit-engine-0.20.1 vs test/models/hook_test.rb in shipit-engine-0.21.0
- old
+ new
@@ -56,17 +56,18 @@
assert @hook.scoped?
end
test "#purge_old_deliveries!" do
Hook.deliver(:deploy, @stack, 'foo' => 42)
+ @hook.deliveries.update_all(status: 'sent')
- previous_ids = @hook.deliveries.order(created_at: :desc).pluck(:id)
+ previous_ids = @hook.deliveries.sent.order(id: :desc).pluck(:id)
- assert_difference -> { @hook.deliveries.count }, -1 do
+ assert_difference -> { @hook.deliveries.sent.count }, -1 do
@hook.purge_old_deliveries!(keep: 1)
end
- after_ids = @hook.deliveries.order(created_at: :desc).pluck(:id)
+ after_ids = @hook.deliveries.sent.order(id: :desc).pluck(:id)
assert_equal previous_ids[0..-2], after_ids
end
end
end