From 0a25818c6b8a29890133ce7b6e1c4039d965cc0f Mon Sep 17 00:00:00 2001 From: Robert Gleeson Date: Fri, 31 Jan 2014 02:43:13 +0100 Subject: [PATCH] cleanup in config_spec.rb --- spec/config_spec.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/spec/config_spec.rb b/spec/config_spec.rb index 21c94918..7a1f71d6 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -2,33 +2,30 @@ require 'helper' describe Pry::Config do describe "reserved keys" do - before do - @config = Pry::Config.from_hash({}, nil) - end - it "raises an ArgumentError on assignment of a reserved key" do + local = Pry::Config.from_hash({}) Pry::Config::RESERVED_KEYS.each do |key| - should.raise(ArgumentError) { @config[key] = 1 } + should.raise(ArgumentError) { local[key] = 1 } end end end describe "traversal to parent" do it "traverses back to the parent when a local key is not found" do - config = Pry::Config.new Pry::Config.from_hash(foo: 1) - config.foo.should == 1 + local = Pry::Config.new Pry::Config.from_hash(foo: 1) + local.foo.should == 1 end it "stores a local key and prevents traversal to the parent" do - config = Pry::Config.new Pry::Config.from_hash(foo: 1) - config.foo = 2 - config.foo.should == 2 + local = Pry::Config.new Pry::Config.from_hash(foo: 1) + local.foo = 2 + local.foo.should == 2 end it "duplicates a copy on read from the parent" do ukraine = "i love" - config = Pry::Config.new Pry::Config.from_hash(home: ukraine) - config.home.equal?(ukraine).should == false + local = Pry::Config.new Pry::Config.from_hash(home: ukraine) + local.home.equal?(ukraine).should == false end it "forgets a local copy in favor of the parent's new value" do