Sha256: 41c372e20fffccc0dde352b569b580c4d72dc0c1419db22a71791b12a8369676
Contents?: true
Size: 1014 Bytes
Versions: 13
Compression:
Stored size: 1014 Bytes
Contents
# frozen_string_literal: true require_relative '../../lib/csv_decision' describe CSVDecision::Matchers::Constant do describe '#matches?' do context 'constant matches value' do data = [ ['= 1', 1], ['== 1', 1], [':=1', 1], ['==.1', BigDecimal('0.1')], [':= 1.1', BigDecimal('1.1')] ] data.each do |cell, value| it "constant #{cell} matches #{value}" do proc = described_class.matches?(cell) expect(proc).to be_a(CSVDecision::Matchers::Proc) expect(proc.type).to eq :constant expect(proc.function).to eq value end end end context 'does not match strings and non-constants' do data = ['true', 'nil', 'false', ':column', '> 0', '!= 1.0', 'abc.*def', '-1..1', '0...3'] data.each do |cell| it "cell #{cell} is not a non-string constant}" do expect(described_class.matches?(cell)).to eq false end end end end end
Version data entries
13 entries across 13 versions & 2 rubygems