Skip to content

Instantly share code, notes, and snippets.

@stufro
stufro / version1.rb
Last active April 24, 2023 19:53
Splitting up cucumber feature files based on number of scenarios
# recursively places features into groups in turn
class CucumberSlicer
def initialize(slices:)
@slices = slices
end
def slice
feature_files = Dir.glob("features/**/*.feature")
sorted_features = feature_files.map { |filepath| [filepath, scenario_count(filepath)] }
@stufro
stufro / return_mocked_object.cr
Created May 20, 2023 14:30
Crystal Spectator - using `inject_mock`
# spec.cr
require "spectator"
require "./spec_helper"
Spectator.describe OrderCalculator do
inject_mock Database
def_mock(Product)
it "multiplies the product price by given quantity" do
product = new_mock(Product)