Sha256: 1508b9ba3a2fecbe08053af5d7877638fd82fdfd3947edb4a2476061f292be27

Contents?: true

Size: 655 Bytes

Versions: 12

Compression:

Stored size: 655 Bytes

Contents

require 'spec_helper'
module Finitio
  describe ProcWithCode do

    it 'acts like a proc' do
      p = ProcWithCode.new{|t| t>0 }
      expect(p).to be_a(Proc)
      expect(p.call(2)).to eq(true)
      expect(p.call(-2)).to eq(false)
    end

    it 'lets compile from source code' do
      p = ProcWithCode.new("t", "t>0")
      expect(p).to be_a(Proc)
      expect(p.call(2)).to eq(true)
      expect(p.call(-2)).to eq(false)
    end

    it 'yields equal procs for same source code' do
      p1 = ProcWithCode.new("t", "t>0")
      p2 = ProcWithCode.new("t", "t>0")
      expect(p1).to eql(p2)
      expect(p1.hash).to eql(p2.hash)
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/support/test_proc_with_code.rb
finitio-0.11.4 spec/support/test_proc_with_code.rb
finitio-0.11.3 spec/support/test_proc_with_code.rb
finitio-0.11.2 spec/support/test_proc_with_code.rb
finitio-0.11.1 spec/support/test_proc_with_code.rb
finitio-0.10.0 spec/support/test_proc_with_code.rb
finitio-0.9.1 spec/support/test_proc_with_code.rb
finitio-0.9.0 spec/support/test_proc_with_code.rb
finitio-0.8.0 spec/support/test_proc_with_code.rb
finitio-0.7.0 spec/support/test_proc_with_code.rb
finitio-0.7.0.pre.rc4 spec/support/test_proc_with_code.rb
finitio-0.7.0.pre.rc3 spec/support/test_proc_with_code.rb