Module: RSpecMagic::Stable::ContextWhen

Defined in:
lib/rspec_magic/stable/context_when.rb

Overview

Create a self-descriptive "when …" context with one or more let variables defined. The blocks below are synonymous.

context_when name: "Joe", age: 25 do
  it do
    expect([name, age]).to eq ["Joe", 25]
  end
end

context "when { name: \"Joe\", age: 25 }" do
  let(:name) { "Joe" }
  let(:age) { 25 }
  it do
    expect([name, age]).to eq ["Joe", 25]
  end
end

Features

Prepend x to context_when to exclude it:

xcontext_when  do
  
end

Define a custom report line formatter:

describe "" do
  def self._context_when_formatter(h)
    "when #{h.to_json}"
  end

  context_when  do
    
  end
end

Defined Under Namespace

Modules: Exports