Sha256: 0f676eef9ed9424545db888bb8af506615116f678f6763e4d3d593e24a245457
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
require 'spec_helper' module WLang class Dialect describe Evaluation, "evaluate" do include Evaluation let(:struct){ Struct.new(:who) } it 'works with a hash' do with_scope({:who => "World"}) do evaluate("who").should eq("World") evaluate(:who).should eq("World") end end it 'works with a struct' do with_scope(struct.new("World")) do evaluate("who").should eq("World") evaluate(:who).should eq("World") end end it 'uses the hash in priority' do with_scope({:keys => [1,2,3]}) do evaluate("keys").should eq([1,2,3]) end end it 'falls back to send' do with_scope({:who => "World"}) do evaluate("keys").should eq([:who]) end end it 'raises a NameError when not found' do lambda{ evaluate("who") }.should raise_error(NameError) end end # describe Evaluation, "evaluate" end # class Dialect end # module WLang
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wlang-2.0.0.beta | spec/unit/dialect/test_evaluate.rb |