Sha256: 43163db7da166294f5af7421f0d7cf93556c71f98b176bfbf37eac166b0f7bed
Contents?: true
Size: 836 Bytes
Versions: 19
Compression:
Stored size: 836 Bytes
Contents
require 'spec_helper' module Finitio describe Syntax, "unnamed_constraint" do subject{ Syntax.parse(input, root: "unnamed_constraint") } let(:compiled){ subject.compile("a") } let(:ast){ subject.to_ast("a") } context 'a >= 10' do let(:input){ 'a >= 10' } it 'compiles to an Constraint' do expect(compiled).to be_a(Constraint) end it 'is anonymous' do expect(compiled).to be_anonymous end it 'should be the correct Proc' do expect(compiled.===(12)).to eq(true) expect(compiled.===(9)).to eq(false) end it 'has the expected AST' do expect(ast).to eq([ :constraint, "default", [:fn, [:parameters, "a"], [:source, "a >= 10"]] ]) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems