Add coverage for CLI::Cache
command (#25238)
This commit is contained in:
parent
215081240f
commit
07933db788
4 changed files with 113 additions and 14 deletions
|
@ -79,6 +79,7 @@ RSpec.configure do |config|
|
|||
|
||||
config.before :each, type: :cli do
|
||||
stub_stdout
|
||||
stub_reset_connection_pools
|
||||
end
|
||||
|
||||
config.before :each, type: :feature do
|
||||
|
@ -121,9 +122,20 @@ def attachment_fixture(name)
|
|||
end
|
||||
|
||||
def stub_stdout
|
||||
# TODO: Is there a bettery way to:
|
||||
# - Avoid CLI command output being printed out
|
||||
# - Allow rspec to assert things against STDOUT
|
||||
# - Avoid disabling stdout for other desirable output (deprecation warnings, for example)
|
||||
allow($stdout).to receive(:write)
|
||||
end
|
||||
|
||||
def stub_reset_connection_pools
|
||||
# TODO: Is there a better way to correctly run specs without stubbing this?
|
||||
# (Avoids reset_connection_pools! in test env)
|
||||
allow(ActiveRecord::Base).to receive(:establish_connection)
|
||||
allow(RedisConfiguration).to receive(:establish_pool)
|
||||
end
|
||||
|
||||
def stub_jsonld_contexts!
|
||||
stub_request(:get, 'https://www.w3.org/ns/activitystreams').to_return(request_fixture('json-ld.activitystreams.txt'))
|
||||
stub_request(:get, 'https://w3id.org/identity/v1').to_return(request_fixture('json-ld.identity.txt'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue