Add webmock to intercept real http connections during tests

Intercepting real http connections also allows running the test
suite without an internet connection.
This commit is contained in:
Andy Allan 2016-10-28 13:35:48 +01:00
parent d478f94239
commit 6bc488a983
3 changed files with 12 additions and 1 deletions

View file

@ -101,6 +101,7 @@ group :test do
gem "rubocop" gem "rubocop"
gem "timecop" gem "timecop"
gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20] gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20]
gem "webmock"
end end
# Needed in development as well so rake can see konacha tasks # Needed in development as well so rake can see konacha tasks

View file

@ -75,6 +75,8 @@ GEM
term-ansicolor (~> 1.3) term-ansicolor (~> 1.3)
thor (~> 0.19.1) thor (~> 0.19.1)
tins (>= 1.6.0, < 2) tins (>= 1.6.0, < 2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.2) crass (1.0.2)
dalli (2.7.6) dalli (2.7.6)
deadlock_retry (1.2.0) deadlock_retry (1.2.0)
@ -94,6 +96,7 @@ GEM
geoip (1.6.2) geoip (1.6.2)
globalid (0.3.7) globalid (0.3.7)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
hashdiff (0.3.0)
hashie (3.4.6) hashie (3.4.6)
htmlentities (4.3.4) htmlentities (4.3.4)
http_accept_language (2.0.5) http_accept_language (2.0.5)
@ -257,6 +260,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-openid (2.7.0) ruby-openid (2.7.0)
ruby-progressbar (1.8.1) ruby-progressbar (1.8.1)
safe_yaml (1.0.4)
sanitize (4.4.0) sanitize (4.4.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
@ -298,6 +302,10 @@ GEM
validates_email_format_of (1.6.3) validates_email_format_of (1.6.3)
i18n i18n
vendorer (0.1.16) vendorer (0.1.16)
webmock (1.24.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.4) websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.2)
@ -359,6 +367,7 @@ DEPENDENCIES
uglifier (>= 1.3.0) uglifier (>= 1.3.0)
validates_email_format_of (>= 1.5.1) validates_email_format_of (>= 1.5.1)
vendorer vendorer
webmock
BUNDLED WITH BUNDLED WITH
1.10.6 1.11.2

View file

@ -4,6 +4,7 @@ Coveralls.wear!("rails")
ENV["RAILS_ENV"] = "test" ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__) require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help" require "rails/test_help"
require "webmock/minitest"
load "composite_primary_keys/fixtures.rb" load "composite_primary_keys/fixtures.rb"
module ActiveSupport module ActiveSupport