about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorMike Burns <mburns@thoughtbot.com>2018-01-17 06:45:09 -0500
committerEugen Rochko <eugen@zeonfederated.com>2018-01-17 12:45:09 +0100
commitea75ae2d1fd987075f600fca66003e2f69cc6cca (patch)
treec3cd7737fd84d1ce1505a84521bd7d4f29d1dfeb /spec
parentacb982fc6677e727980ac71f58e64d35e9576a3b (diff)
Use be_within instead of eq for a to_f test match (#6275)
Floating point values are notoriously hard to pin down, so use the
`be_within` matcher to verify the approximate value.
Diffstat (limited to 'spec')
-rw-r--r--spec/services/precompute_feed_service_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/services/precompute_feed_service_spec.rb b/spec/services/precompute_feed_service_spec.rb
index d1ef6c184..396a3c3fb 100644
--- a/spec/services/precompute_feed_service_spec.rb
+++ b/spec/services/precompute_feed_service_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe PrecomputeFeedService do
 
       subject.call(account)
 
-      expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq status.id.to_f
+      expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to be_within(0.1).of(status.id.to_f)
     end
 
     it 'does not raise an error even if it could not find any status' do