Sha256: f36e6a42a348064c625c54f942cf6587efa33a446e66cd27a9715ade70ae2cbd

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

require 'spec_helper'
module WLang
  class Scope
    describe BindingScope do

      it 'implements fetch through eval' do
        who = "World"
        scope = Scope.coerce(binding)
        scope.fetch(:who).should eq("World")
      end

      it 'delegates fetch to its parent when not found' do
        scope = Scope.coerce(binding, Scope.coerce(:who => "World"))
        scope.fetch(:who).should eq("World")
      end

      it 'fetches `self` correctly' do
        o = Object.new
        x = o.instance_eval do
          Scope.coerce(binding).fetch(:self)
        end
        x.should eq(o)
      end

    end # describe BindingScope
  end # class Scope
end # module WLang

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wlang-2.0.1 spec/unit/scope/test_binding_scope.rb
wlang-2.0.0 spec/unit/scope/test_binding_scope.rb
wlang-2.0.0.beta spec/unit/scope/test_binding_scope.rb