Retry a command until it fails.
Debugging brittle specs is annoying and time consuming work. Let's automate finding those brittle specs by retrying them until they fail.
Accompanying blog post.
| require 'concurrent/array' | |
| Capybara::Session.prepend(Spec::Support::Capybara::Console) | |
| module Spec | |
| module Support | |
| module Capybara | |
| module Console | |
| def driver | |
| @driver ||= super.tap { console.register } |
| <?php | |
| /** | |
| * Very simple PHP class to utilize comotive mail | |
| * @package LBWP\Helper\Mail | |
| */ | |
| class CMailApp | |
| { | |
| /** | |
| * @var string the host uri |
Retry a command until it fails.
Debugging brittle specs is annoying and time consuming work. Let's automate finding those brittle specs by retrying them until they fail.
Accompanying blog post.
| # /spec/support/documentation/after_rspec_example.rb | |
| # Normally, we'd want to break into multiple files, but then it becomes more to install (unless gemified) | |
| module SomeApp | |
| module Documentation | |
| class AfterRspecExample | |
| def self.apply!(context, example, response) | |
| SwaggerExample::Request.apply!(context, example, response) | |
| SwaggerExample::Response.apply!(context, example, response) | |
| end |
| ruby '2.7.1' | |
| gem 'rails', github: 'rails/rails' | |
| gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
| # Action Text | |
| gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
| gem 'okra', github: 'basecamp/okra' | |
| # Drivers |
Sometimes it's useful to know what IP ranges our servers are operating in. Since we run on Heroku, it's a little complicated. However, Heroku runs on AWS, which has this page dedicated to IP Ranges by Region.
Heroku recommends using this to identify which region are bing in use. If dynos are run in common spaces in US region, we can look up information about this region using Heroku's API:
using httpie:
http https://api.heroku.com/regions/us "Accept:application/vnd.heroku+json; version=3"| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| # gem 'rails', '~> 5.2' |
| version: 2.1 | |
| orbs: | |
| heroku: circleci/heroku@0.0.4 | |
| references: | |
| container_setup: &container_setup | |
| docker: # run the steps with Docker | |
| - image: circleci/ruby:2.6.0-rc1-node # ...with this image as the primary container; this is where all `steps` will run | |
| environment: # environment variables for primary container |
initialize: once, when the controller is first instantiatedconnect: anytime the controller is connected to the DOM