diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-02-28 19:07:17 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-02-28 19:07:17 +0100 |
commit | a0f5ff4c3cd05f8717be2bf1d79f0817f288d398 (patch) | |
tree | 441f409cf816cf8a61dacdbaf204ae9f5cbe2f18 /spec/ruby/core/binding | |
parent | 5d210501825e1682e68cbfc2be424fc339f382fa (diff) |
Update to ruby/spec@41bf282
Diffstat (limited to 'spec/ruby/core/binding')
-rw-r--r-- | spec/ruby/core/binding/eval_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/binding/fixtures/classes.rb | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/ruby/core/binding/eval_spec.rb b/spec/ruby/core/binding/eval_spec.rb index 84096f8a91..224bce4c33 100644 --- a/spec/ruby/core/binding/eval_spec.rb +++ b/spec/ruby/core/binding/eval_spec.rb @@ -131,4 +131,10 @@ describe "Binding#eval" do bind, meth = obj.get_binding_with_send_and_method bind.eval("__method__").should == meth end + + it "reflects refinements activated in the binding scope" do + bind = BindingSpecs::Refined.refined_binding + + bind.eval("'bar'.foo").should == "foo" + end end diff --git a/spec/ruby/core/binding/fixtures/classes.rb b/spec/ruby/core/binding/fixtures/classes.rb index 43e32cacf6..b5f3ce9008 100644 --- a/spec/ruby/core/binding/fixtures/classes.rb +++ b/spec/ruby/core/binding/fixtures/classes.rb @@ -49,4 +49,18 @@ module BindingSpecs end end end + + module AddFooToString + refine(String) do + def foo + "foo" + end + end + end + class Refined + using AddFooToString + def self.refined_binding + binding + end + end end |