Fix RSpec/AnyInstance
cop (#27810)
This commit is contained in:
parent
d562fb8459
commit
b2c5b20ef2
14 changed files with 70 additions and 60 deletions
|
@ -64,8 +64,11 @@ describe Request do
|
|||
end
|
||||
|
||||
it 'closes underlying connection' do
|
||||
expect_any_instance_of(HTTP::Client).to receive(:close)
|
||||
allow(subject.send(:http_client)).to receive(:close)
|
||||
|
||||
expect { |block| subject.perform(&block) }.to yield_control
|
||||
|
||||
expect(subject.send(:http_client)).to have_received(:close)
|
||||
end
|
||||
|
||||
it 'returns response which implements body_with_limit' do
|
||||
|
|
|
@ -23,7 +23,8 @@ describe StatusFilter do
|
|||
|
||||
context 'when status policy does not allow show' do
|
||||
it 'filters the status' do
|
||||
allow_any_instance_of(StatusPolicy).to receive(:show?).and_return(false)
|
||||
policy = instance_double(StatusPolicy, show?: false)
|
||||
allow(StatusPolicy).to receive(:new).and_return(policy)
|
||||
|
||||
expect(filter).to be_filtered
|
||||
end
|
||||
|
@ -74,7 +75,8 @@ describe StatusFilter do
|
|||
|
||||
context 'when status policy does not allow show' do
|
||||
it 'filters the status' do
|
||||
allow_any_instance_of(StatusPolicy).to receive(:show?).and_return(false)
|
||||
policy = instance_double(StatusPolicy, show?: false)
|
||||
allow(StatusPolicy).to receive(:new).and_return(policy)
|
||||
|
||||
expect(filter).to be_filtered
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue