Module: Crabfarm::RSpec::ReducerSpecHelpers
- Defined in:
- lib/crabfarm/rspec/reducer_spec_helpers.rb
Instance Method Summary collapse
Instance Method Details
#reduce(_snapshot, _params = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/crabfarm/rspec/reducer_spec_helpers.rb', line 5 def reduce(_snapshot, _params={}) ensure_reducer_for :reduce raise ArgumentError.new 'Must provide a snapshot for reducer specs' if _snapshot.nil? snap_path = described_class.snapshot_path _snapshot raise ArgumentError.new "Snapshot does not exist #{snap_path}" unless File.exist? snap_path reducer = Factories::SnapshotReducer.build described_class, snap_path, (_params || {}) reducer.run reducer end |
#reducer ⇒ Object
17 18 19 |
# File 'lib/crabfarm/rspec/reducer_spec_helpers.rb', line 17 def reducer @reducer_state ||= reduce @reducer_snapshot, @reducer_params end |