spec/support/fakes/fake_fault_once_station.rb
21 lines · ruby
Project files
# frozen_string_literal: true
require "press_results"
class FakeFaultOnceStation
attr_reader :name, :fact, :attempts
def initialize(name:, fact:, fault:)
@name = name
@fact = fact
@fault = fault
@attempts = 0
end
def apply(work)
@attempts += 1
return StationResult.new(work:, fault: @fault) if @attempts == 1
StationResult.new(work: work.with_fact(fact), fault: nil)
end
end
Read along in the manual: The Reloading Lab · Download the project (zip)