Silence output to stdout during cli specs (#25211)
This commit is contained in:
parent
dc26140d54
commit
b0104e4c33
@ -62,6 +62,10 @@ RSpec.configure do |config|
|
||||
config.infer_spec_type_from_file_location!
|
||||
config.filter_rails_from_backtrace!
|
||||
|
||||
config.define_derived_metadata(file_path: Regexp.new('spec/lib/mastodon/cli')) do |metadata|
|
||||
metadata[:type] = :cli
|
||||
end
|
||||
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include Devise::Test::ControllerHelpers, type: :helper
|
||||
config.include Devise::Test::ControllerHelpers, type: :view
|
||||
@ -73,6 +77,10 @@ RSpec.configure do |config|
|
||||
config.include Redisable
|
||||
config.include SignedRequestHelpers, type: :request
|
||||
|
||||
config.before :each, type: :cli do
|
||||
stub_stdout
|
||||
end
|
||||
|
||||
config.before :each, type: :feature do
|
||||
https = ENV['LOCAL_HTTPS'] == 'true'
|
||||
Capybara.app_host = "http#{https ? 's' : ''}://#{ENV.fetch('LOCAL_DOMAIN')}"
|
||||
@ -106,6 +114,10 @@ def attachment_fixture(name)
|
||||
Rails.root.join('spec', 'fixtures', 'files', name).open
|
||||
end
|
||||
|
||||
def stub_stdout
|
||||
allow($stdout).to receive(:write)
|
||||
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…
Reference in New Issue
Block a user