Fix various warnings in rspec (#14729)

This commit is contained in:
Eugen Rochko 2020-09-04 20:22:26 +02:00 committed by GitHub
parent 272aa4a109
commit 68d3b160de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View File

@ -441,7 +441,7 @@ RSpec.describe FeedManager do
FeedManager.instance.push_to_home(receiver, another_status) FeedManager.instance.push_to_home(receiver, another_status)
# We should have a tracking set and an entry in reblogs. # We should have a tracking set and an entry in reblogs.
expect(Redis.current.exists(reblog_set_key)).to be true expect(Redis.current.exists?(reblog_set_key)).to be true
expect(Redis.current.zrange(reblogs_key, 0, -1)).to eq [reblogged.id.to_s] expect(Redis.current.zrange(reblogs_key, 0, -1)).to eq [reblogged.id.to_s]
# Push everything off the end of the feed. # Push everything off the end of the feed.
@ -454,7 +454,7 @@ RSpec.describe FeedManager do
FeedManager.instance.trim('home', receiver.id) FeedManager.instance.trim('home', receiver.id)
# We should not have any reblog tracking data. # We should not have any reblog tracking data.
expect(Redis.current.exists(reblog_set_key)).to be false expect(Redis.current.exists?(reblog_set_key)).to be false
expect(Redis.current.zrange(reblogs_key, 0, -1)).to be_empty expect(Redis.current.zrange(reblogs_key, 0, -1)).to be_empty
end end
end end

View File

@ -150,9 +150,9 @@ RSpec.describe SpamCheck do
let(:redis_key) { spam_check.send(:redis_key) } let(:redis_key) { spam_check.send(:redis_key) }
it 'remembers' do it 'remembers' do
expect(Redis.current.exists(redis_key)).to be true expect(Redis.current.exists?(redis_key)).to be true
spam_check.remember! spam_check.remember!
expect(Redis.current.exists(redis_key)).to be true expect(Redis.current.exists?(redis_key)).to be true
end end
end end
@ -166,9 +166,9 @@ RSpec.describe SpamCheck do
end end
it 'resets' do it 'resets' do
expect(Redis.current.exists(redis_key)).to be true expect(Redis.current.exists?(redis_key)).to be true
spam_check.reset! spam_check.reset!
expect(Redis.current.exists(redis_key)).to be false expect(Redis.current.exists?(redis_key)).to be false
end end
end end

View File

@ -55,9 +55,9 @@ RSpec.describe UnallowDomainService, type: :service do
end end
it 'removes the remote accounts\'s statuses and media attachments' do it 'removes the remote accounts\'s statuses and media attachments' do
expect { bad_status1.reload }.to_not raise_exception ActiveRecord::RecordNotFound expect { bad_status1.reload }.to_not raise_error
expect { bad_status2.reload }.to_not raise_exception ActiveRecord::RecordNotFound expect { bad_status2.reload }.to_not raise_error
expect { bad_attachment.reload }.to_not raise_exception ActiveRecord::RecordNotFound expect { bad_attachment.reload }.to_not raise_error
end end
end end
end end

View File

@ -16,8 +16,8 @@ describe Scheduler::FeedCleanupScheduler do
expect(Redis.current.zcard(feed_key_for(inactive_user))).to eq 0 expect(Redis.current.zcard(feed_key_for(inactive_user))).to eq 0
expect(Redis.current.zcard(feed_key_for(active_user))).to eq 1 expect(Redis.current.zcard(feed_key_for(active_user))).to eq 1
expect(Redis.current.exists(feed_key_for(inactive_user, 'reblogs'))).to be false expect(Redis.current.exists?(feed_key_for(inactive_user, 'reblogs'))).to be false
expect(Redis.current.exists(feed_key_for(inactive_user, 'reblogs:2'))).to be false expect(Redis.current.exists?(feed_key_for(inactive_user, 'reblogs:2'))).to be false
end end
def feed_key_for(user, subtype = nil) def feed_key_for(user, subtype = nil)