Sha256: fd25dcfc05f0fb63efa9f14a9774d0e7023b4f39d06c0bcac61422f22c18588f

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe RipperPlus::ScopeStack do
  before do
    @stack = RipperPlus::ScopeStack.new
  end
  
  it 'can see variables added at top level' do
    @stack.should_not have_variable(:hello)
    @stack.add_variable :hello
    @stack.should have_variable(:hello)
  end
  
  it 'can not see variables added beyond a closed scope' do
    @stack.add_variable :hello
    @stack.with_closed_scope do
      @stack.should_not have_variable(:hello)
    end
    @stack.should have_variable(:hello)
  end
  
  it 'can see variables added beyond an open scope' do
    @stack.add_variable :hello
    @stack.with_open_scope do
      @stack.should have_variable(:hello)
    end
    @stack.should have_variable(:hello)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ripper-plus-1.0.1 spec/scope_stack_spec.rb
ripper-plus-1.0.0 spec/scope_stack_spec.rb