Sha256: 3d49bd71546c6b26eda9023f0d0912c29e3d6bb75d9127cb864eafe234c2868e
Contents?: true
Size: 1011 Bytes
Versions: 19
Compression:
Stored size: 1011 Bytes
Contents
require 'spec_helper' module Finitio describe Constraint, "==" do def constraint(proc, name = nil) Constraint.new(proc, name) end it 'recognizes same procs' do expect(constraint(byte_min)).to eq(constraint(byte_min)) end it 'recognizes non constraints' do expect(constraint(byte_min)).not_to eq(nil) expect(constraint(byte_min)).not_to eq(1) end it 'recognizes non equivalent constraints' do expect(constraint(byte_min)).not_to eq(constraint(byte_max)) end it 'does not take name into accound' do expect(constraint(byte_min, :foo)).to eq(constraint(byte_min, :bar)) end it 'implements hash accordingly' do c1 = constraint(byte_min) c2 = constraint(byte_min) expect(c1.hash).to eq(c2.hash) end it 'is smart enough to have different hash codes for different constraints' do c1 = constraint(byte_min) c2 = constraint(byte_max) expect(c1.hash).not_to eq(c2.hash) end end end
Version data entries
19 entries across 19 versions & 1 rubygems