Sha256: 6e476c8edc66144ad1697f3c230205fb16a14d462c3a75a4f823864d9777d549
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' module Qrb describe Syntax, "constraints" do subject{ Syntax.parse(input, root: "constraints") } let(:compiled){ subject.compile("a") } context 'a >= 10' do let(:input){ 'a >= 10' } it 'compiles to an Hash' do compiled.should be_a(Hash) compiled.keys.should eq([:predicate]) end end context 'foo: a >= 10' do let(:input){ 'foo: a >= 10' } it 'compiles to an Hash' do compiled.should be_a(Hash) compiled.keys.should eq([:foo]) end end context 'foo: a >= 10, bar: a <= 255' do let(:input){ 'foo: a >= 10, bar: a <= 255' } it 'compiles to an Hash' do compiled.should be_a(Hash) compiled.keys.should eq([:foo, :bar]) end end context 'foo: a >= 10, foo: a <= 255' do let(:input){ 'foo: a >= 10, foo: a <= 255' } it 'compiles to an Hash' do ->{ compiled }.should raise_error("Duplicate constraint name `foo`") 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_constraints.rb |
qrb-0.1.0 | spec/unit/syntax/nodes/test_constraints.rb |