Sha256: 0b1706d814fc9b3b55ebdd075d52f1cf6c6145808b294af09c94fec6e56237bd

Contents?: true

Size: 607 Bytes

Versions: 2

Compression:

Stored size: 607 Bytes

Contents

require 'spec_helper'
module Qrb
  describe Syntax, "unnamed_constraint" do

    subject{
      Syntax.parse(input, root: "unnamed_constraint")
    }

    let(:compiled){
      subject.compile("a")
    }

    context 'a >= 10' do
      let(:input){ 'a >= 10' }

      it 'compiles to an Hash' do
        compiled.should be_a(Hash)
      end

      it 'has expected keys' do
        compiled.keys.should eq([:predicate])
      end

      it 'should be the correct Proc' do
        compiled[:predicate].call(12).should be_true
        compiled[:predicate].call(9).should be_false
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qrb-0.2.0 spec/unit/syntax/nodes/test_unnamed_constraint.rb
qrb-0.1.0 spec/unit/syntax/nodes/test_unnamed_constraint.rb