Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: aac4d1b7b58d
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d64a4567746b
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Mar 3, 2015

  1. Verified

    This commit was signed with the committer’s verified signature.
    makenowjust Hiroya Fujinami
    Copy the full SHA
    a0e4404 View commit details
  2. Merge pull request #3338 from ruipserra/add_binding_local_variables_s…

    …pecs
    
    Add failing specs for Binding#local_variables
    Yorick Peterse committed Mar 3, 2015
    Copy the full SHA
    d64a456 View commit details
Showing with 34 additions and 0 deletions.
  1. +29 −0 spec/ruby/core/binding/local_variables_spec.rb
  2. +5 −0 spec/tags/ruby/core/binding/local_variables_tags.txt
29 changes: 29 additions & 0 deletions spec/ruby/core/binding/local_variables_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "Binding#local_variables" do
it "returns an Array" do
binding.local_variables.should be_kind_of(Array)
end

it "includes local variables in the current scope" do
a = 1
b = nil
binding.local_variables.should == [:a, :b]
end

it "includes local variables defined after calling binding.local_variables" do
binding.local_variables.should == [:a, :b]
a = 1
b = 2
end

it "includes local variables of inherited scopes and eval'ed context" do
p = proc { |a| b = 1; eval("c = 2; binding.local_variables") }
p.call.should == [:c, :a, :b, :p]
end

it "includes shadowed local variables only once" do
a = 1
proc { a = 2; binding.local_variables }.call.should == [:a]
end
end
5 changes: 5 additions & 0 deletions spec/tags/ruby/core/binding/local_variables_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fails:Binding#local_variables returns an Array
fails:Binding#local_variables includes local variables in the current scope
fails:Binding#local_variables includes local variables defined after calling binding.local_variables
fails:Binding#local_variables includes local variables of inherited scopes and eval'ed context
fails:Binding#local_variables includes shadowed local variables only once