View spec_helper.rb
RSpec.configure do |rspec|
if ENV["CI"]
rspec.before(:example, :focus) do
raise "Do not commit examples tagged with :focus"
rspec.filter_run_when_matching :focus
View worker.ex
alias Experimental.GenStage
defmodule WorkerPool.Worker do
@type subscription_options :: Keyword.t
@type producer :: pid | {pid, subscription_options}
@doc """
Starts a worker, subscribed to the provided job producers.
@spec start_link([producer], Keyword.t) :: {:ok, pid}
View synchronize_death_on_exit.ex
@doc """
Will ensure the processes with the test does not complete until the process with the
provided pid has exited. This is necessary when writing multiple tests that start the
same named process. See for more info.
This accepts either `{:ok, pid}` or just `pid` so that you can use it in a pipeline
after a `start_link` call.
def synchronize_death_on_exit({:ok, pid}) when is_pid(pid), do: synchronize_death_on_exit(pid)
def synchronize_death_on_exit(pid) when is_pid(pid) do
View registry.ex
defmodule Registry do
# ...
def handle_call({:execute_against_shard, campaign_id, fun}, from, state) do
{shard_process, state} = find_or_create_shard(campaign_id, state)
ShardProcess.execute_and_reply(shard_process, fun, from)
{:noreply, state}
# ...
View Rakefile
require 'rspec/core/rake_task' do |t|
t.rspec_opts = "--out tmp/specs_task.out"
task :specs => :specs_prep do
results ="tmp/specs_task.out")
# do something with results
View inverse_hook_filtering.rb
RSpec.configure do |config|
# Either put conditional logic in the hook...
config.around(:example) do |ex|
unless ex.metadata[:slow]
puts "Not tagged slow"
View rspec_output.txt
A group of examples
 is pending (PENDING: not yet passing)
 fails (FAILED - 1)
 fails with a diff (FAILED - 2)
 fails with a multiline snippet in order to show off syntax highlighting (FAILED - 3)
Pending: (Failures listed here are expected and do not affect your suite's status)
View response.txt
HTTP/1.1 400 Bad Request
connection: close
server: Cowboy
date: Tue, 24 Nov 2015 20:24:58 GMT
content-length: 0

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
View supervisor.ex
defmodule Delorean.RankingsShardRepository.RunningShard.Supervisor do
use Supervisor
def start_link(opts) do
Supervisor.start_link(__MODULE__, opts, [])
def start_shard(supervisor, shard_opts) do
Supervisor.start_child(supervisor, shard_opts)