From ee176d3761ab6b614b125a2ce46ee8aec4a7385f Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 29 Aug 2018 21:50:12 +0200 Subject: [PATCH] Moved RSpec Webmock configuration in own support file and allowed requests to Google for Calendar setup. --- spec/rails_helper.rb | 3 --- spec/support/webmock.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 spec/support/webmock.rb diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 94bb1a4bf..81792f90d 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -30,9 +30,6 @@ ActiveRecord::Migration.maintain_test_schema! # make sure that all migrations of linked packages are executed Package::Migration.linked -# allow requests to Zammad webservices -WebMock.disable_net_connect!(allow: /zammad\.com/) - RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb new file mode 100644 index 000000000..2c11259b6 --- /dev/null +++ b/spec/support/webmock.rb @@ -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 +)