From b270761efa7e111db75ab2d9430f18162f2f6c58 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 2 Jan 2012 20:23:22 +0100 Subject: [PATCH] Don't raise for unrecognized options. When calling Pry.new() or Pry#refresh and passing custom options these options should not be set (and therefor prevent NoMethodErrors from popping up). Signed-off-by: Yorick Peterse --- lib/pry/pry_instance.rb | 2 +- test/test_pry.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 4028ae0a..a65fb6e8 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -59,7 +59,7 @@ class Pry end defaults.merge!(options).each do |key, value| - send "#{key}=", value + send("#{key}=", value) if respond_to?("#{key}=") end true diff --git a/test/test_pry.rb b/test/test_pry.rb index 64eb3312..f554517b 100644 --- a/test/test_pry.rb +++ b/test/test_pry.rb @@ -1322,4 +1322,12 @@ describe Pry do end end end + + describe 'setting custom options' do + it 'should not raise for unrecognized options' do + should.not.raise?(NoMethodError) { + instance = Pry.new(:custom_option => 'custom value') + } + end + end end