File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def inherited(subclass)
2222 if instance_variable_get ( ivar ) . respond_to? ( :merge )
2323 method = <<-EOM
2424 def self.#{ inheritable_attribute }
25- #{ ivar } = superclass.#{ inheritable_attribute } .merge #{ ivar }
25+ #{ ivar } = superclass.#{ inheritable_attribute } .merge Marshal.load(Marshal.dump( #{ ivar } ))
2626 end
2727 EOM
2828 subclass . class_eval method
Original file line number Diff line number Diff line change @@ -526,6 +526,14 @@ def self.name
526526 @parent . default_options . should == { :basic_auth => { :username => 'user' , :password => 'password' } }
527527 end
528528
529+ it "doesn't modify hashes in the parent's default options" do
530+ @parent . headers 'Accept' => 'application/json'
531+ @child1 . headers 'Accept' => 'application/xml'
532+
533+ @parent . default_options [ :headers ] . should == { 'Accept' => 'application/json' }
534+ @child1 . default_options [ :headers ] . should == { 'Accept' => 'application/xml' }
535+ end
536+
529537 it "inherits default_cookies from the parent class" do
530538 @parent . cookies 'type' => 'chocolate_chip'
531539 @child1 . default_cookies . should == { "type" => "chocolate_chip" }
You can’t perform that action at this time.
0 commit comments