toptal / crystalball

Regression Test Selection library for your RSpec test suite
https://toptal.github.io/crystalball/
MIT License
322 stars 41 forks source link

Use a different map generator configuration for each feature #92

Closed jaimerson closed 6 years ago

jaimerson commented 6 years ago

Usage

# features/my_shiny_feature_spec.rb
require 'feature_helper'

RSpec.describe 'My feature with map generator' do
  include_context 'simple git repository'
  let(:map_generator_config) do
    # must return a string containing the code that will be written in spec_helper.rb
    <<~CONFIG
      Crystalball::MapGenerator.start! do |c|
        c.register Crystalball::MapGenerator::CoverageStrategy.new
      end
      Crystalball::Rails::TablesMapGenerator.start! # if it also needs a table map
    CONFIG
  end
  # ...
end