Sha256: 5bb7bb678c1f2a3d78b84b4b0a5362deec28ece952bb0bcb75664c75a11e6cb0

Contents?: true

Size: 788 Bytes

Versions: 5

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

require_relative '../../lib/csv_decision'

describe CSVDecision::Decision do
  it 'decision for table with no functions and first_match: true' do
    data = <<~DATA
      IN :input, OUT :output, IN: input1
      input0,    output0,     input1
      input0,    output1,
    DATA

    table = CSVDecision.parse(data)

    input = { input: 'input0', input1: 'input1' }

    decision = CSVDecision::Decision.new(table: table, input: input)

    expect(decision).to be_a(CSVDecision::Decision)
    expect(decision.empty?).to eq true
    expect(decision.exist?).to eq false

    row = table.rows[0]
    decision.add(row)

    expect(decision.empty?).to eq false
    expect(decision.exist?).to eq true
    expect(decision.result).to eq(output: 'output0')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
csv_decision-0.0.6 spec/csv_decision/decision_spec.rb
csv_decision-0.0.5 spec/csv_decision/decision_spec.rb
csv_decision-0.0.4 spec/csv_decision/decision_spec.rb
csv_decision-0.0.3 spec/csv_decision/decision_spec.rb
csv_decision-0.0.2 spec/csv_decision/decision_spec.rb