Sha256: 8d6ff02846906de6bb82e8bc13c2d3b115e0c1c6af787ac41fa987777fc71640
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' module Sexpr describe Processor, ".grammar" do subject{ clazz.grammar } context 'on Processor itself' do let(:clazz){ Processor } it{ should be(Sexpr) } end context 'on a subclass defining a grammar' do let(:clazz){ Class.new(Processor){ grammar :foo } } it{ should eq(:foo) } end context 'on a subclass of a rewriter class defining a grammar' do let(:superclazz){ Class.new(Processor){ grammar :foo } } let(:clazz){ Class.new(superclazz) } it{ should eq(:foo) } end context 'on a subclass that overrides the grammar' do let(:superclazz){ Class.new(Processor){ grammar :foo } } let(:clazz){ Class.new(superclazz){ grammar :bar } } it{ should eq(:bar) } it 'should not override on the parent' do superclazz.grammar.should eq(:foo) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sexpr-1.1.0 | spec/unit/processor/test_grammar.rb |
sexpr-1.0.0 | spec/unit/processor/test_grammar.rb |
sexpr-0.6.0 | spec/unit/processor/test_grammar.rb |