Sha256: c297a049fc2c2e281a81ae8ae80088f25d41f5067c32651d58598b824afd0bd4

Contents?: true

Size: 929 Bytes

Versions: 11

Compression:

Stored size: 929 Bytes

Contents

require 'spec_helper'
module WLang
  describe Scope, ".coerce" do

    it 'recognizes Binding' do
      Scope.coerce(binding).should be_a(Scope::BindingScope)
    end

    it 'recognizes Procs' do
      Scope.coerce(lambda{}).should be_a(Scope::ProcScope)
    end

    it 'recognizes Sinatra applications' do
      Scope.coerce(sinatra_app).should be_a(Scope::SinatraScope)
    end

    it 'falls back to ObjectScope on Hash' do
      Scope.coerce({}).should be_a(Scope::ObjectScope)
    end

    it 'falls back to ObjectScope' do
      Scope.coerce(12).should be_a(Scope::ObjectScope)
    end

    it 'returns the Scope if nothing has to be done' do
      Scope.coerce(Scope.null).should eq(Scope.null)
      s = Scope.coerce({})
      Scope.coerce(s).should eq(s)
    end

    it 'returns the Scope on a Scope' do
      s = Scope.coerce({})
      Scope.coerce(s).should eq(s)
    end

  end # describe Scope
end # module WLang

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wlang-3.0.1 spec/unit/scope/test_coerce.rb
wlang-2.3.1 spec/unit/scope/test_coerce.rb
wlang-2.3.0 spec/unit/scope/test_coerce.rb
wlang-2.2.4 spec/unit/scope/test_coerce.rb
wlang-2.2.3 spec/unit/scope/test_coerce.rb
wlang-2.2.2 spec/unit/scope/test_coerce.rb
wlang-2.2.1 spec/unit/scope/test_coerce.rb
wlang-2.2.0 spec/unit/scope/test_coerce.rb
wlang-2.1.2 spec/unit/scope/test_coerce.rb
wlang-2.1.1 spec/unit/scope/test_coerce.rb
wlang-2.1.0 spec/unit/scope/test_coerce.rb