From 6bc488a98397c00b9c6d07480cfb78c2aea729a6 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Fri, 28 Oct 2016 13:35:48 +0100 Subject: [PATCH] Add webmock to intercept real http connections during tests Intercepting real http connections also allows running the test suite without an internet connection. --- Gemfile | 1 + Gemfile.lock | 11 ++++++++++- test/test_helper.rb | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 2cbb1cbef..7d87708f1 100644 --- a/Gemfile +++ b/Gemfile @@ -101,6 +101,7 @@ group :test do gem "rubocop" gem "timecop" gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20] + gem "webmock" end # Needed in development as well so rake can see konacha tasks diff --git a/Gemfile.lock b/Gemfile.lock index d03cd5ad2..6a41a9af0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,6 +75,8 @@ GEM term-ansicolor (~> 1.3) thor (~> 0.19.1) tins (>= 1.6.0, < 2) + crack (0.4.3) + safe_yaml (~> 1.0.0) crass (1.0.2) dalli (2.7.6) deadlock_retry (1.2.0) @@ -94,6 +96,7 @@ GEM geoip (1.6.2) globalid (0.3.7) activesupport (>= 4.1.0) + hashdiff (0.3.0) hashie (3.4.6) htmlentities (4.3.4) http_accept_language (2.0.5) @@ -257,6 +260,7 @@ GEM unicode-display_width (~> 1.0, >= 1.0.1) ruby-openid (2.7.0) ruby-progressbar (1.8.1) + safe_yaml (1.0.4) sanitize (4.4.0) crass (~> 1.0.2) nokogiri (>= 1.4.4) @@ -298,6 +302,10 @@ GEM validates_email_format_of (1.6.3) i18n vendorer (0.1.16) + webmock (1.24.2) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff websocket-driver (0.6.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) @@ -359,6 +367,7 @@ DEPENDENCIES uglifier (>= 1.3.0) validates_email_format_of (>= 1.5.1) vendorer + webmock BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/test/test_helper.rb b/test/test_helper.rb index 0cf7c4afb..7624c0b34 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,6 +4,7 @@ Coveralls.wear!("rails") ENV["RAILS_ENV"] = "test" require File.expand_path("../../config/environment", __FILE__) require "rails/test_help" +require "webmock/minitest" load "composite_primary_keys/fixtures.rb" module ActiveSupport -- 2.43.2