Module: Pangea::Magma::Matchers

Defined in:
lib/pangea/magma/matchers.rb

Overview

RSpec custom matchers for “this workspace works under magma”.

# Usage

require 'pangea/magma/matchers'

RSpec.describe 'seph-vpc workspace' do
  it 'plans cleanly under magma' do
    expect('workspaces/seph-vpc').to plan_cleanly_under_magma
  end

  it 'declares the expected providers' do
    expect('workspaces/seph-vpc').to plan_cleanly_under_magma
      .with_provider('hashicorp/aws')
  end

  it 'emits at least 3 resource changes' do
    expect('workspaces/seph-vpc').to plan_cleanly_under_magma
      .with_at_least(3).resource_changes
  end

  it 'is compatible with magma backend' do
    expect('workspaces/seph-vpc').to be_compatible_with_backend('magma')
  end
end

All matchers skip-with-print when magma isn’t installed so CI on machines without the magma binary doesn’t fail hard.

Defined Under Namespace

Classes: CompatibleWithBackend, PlanCleanlyUnderMagma

Instance Method Summary collapse

Instance Method Details

#be_compatible_with_backend(name) ⇒ Object



165
166
167
# File 'lib/pangea/magma/matchers.rb', line 165

def be_compatible_with_backend(name)
  CompatibleWithBackend.new(name)
end

#plan_cleanly_under_magmaObject



161
162
163
# File 'lib/pangea/magma/matchers.rb', line 161

def plan_cleanly_under_magma
  PlanCleanlyUnderMagma.new
end