Moved RSpec Webmock configuration in own support file and allowed requests to Google for Calendar setup.

This commit is contained in:
Thorsten Eckel 2018-08-29 21:50:12 +02:00
parent 2d8badcb8c
commit ee176d3761
2 changed files with 12 additions and 3 deletions

View file

@ -30,9 +30,6 @@ ActiveRecord::Migration.maintain_test_schema!
# make sure that all migrations of linked packages are executed # make sure that all migrations of linked packages are executed
Package::Migration.linked Package::Migration.linked
# allow requests to Zammad webservices
WebMock.disable_net_connect!(allow: /zammad\.com/)
RSpec.configure do |config| RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures" config.fixture_path = "#{::Rails.root}/spec/fixtures"

12
spec/support/webmock.rb Normal file
View file

@ -0,0 +1,12 @@
# allow requests to:
# - Zammad webservices
# - Google (calendar)
allowed_sites = lambda do |uri|
['zammad.com', 'google.com'].any? do |site|
uri.host.include?(site)
end
end
WebMock.disable_net_connect!(
allow: allowed_sites,
allow_localhost: true
)