In a controller method I set a user's variable
assert_equal @user.activation_sent_at, Time.zone.now
No visible difference in the ActiveSupport::TimeWithZone#inspect output.
You should look at the implementation of #== on ActiveSupport::TimeWithZone or its members.
The issue is that the 2 dates are very close to each other but not the same. You can use
assert_in_delta @user.activation_sent_at, Time.zone.now, 1.second
For RSpec, a similar approach would be to use
expect(@user.activation_sent_at).to be_within(1.second).of Time.zone.now