Skip to content

Instantly share code, notes, and snippets.

View mhaylock's full-sized avatar

Mark Haylock mhaylock

  • abitofthought.com
  • Christchurch, New Zealand
View GitHub Profile
@mhaylock
mhaylock / feature_spec_artifacts.rb
Created August 29, 2016 04:10
An Spec support file for capturing useful debug artifacts when a feature spec fails (integrates with CircleCI to make those artifacts available for review in the "Artifacts" tab of the build).
# frozen_string_literal: true
# When a feature spec fails it can sometimes be difficult to determine the
# cause, here we hook into RSpec and if a feature spec fails we save the
# following artifacts to disk:
#
# - A copy of the HTML of the currently open page.
# - A screenshot of the currently open page (if the Capybara driver supports
# screenshots).
# - A copy of the segment of log/test.log that was generated for the failing
@mhaylock
mhaylock / nock.js
Last active January 17, 2020 10:49
Integrating Nock with Jest
const nock = require('nock')
// Prevent requests being made to any outside services:
nock.disableNetConnect()
// Allow requests through to localhost, which is used by SuperTest to send
// requests during integration tests:
const localhost = '127.0.0.1'
nock.enableNetConnect(localhost)