Permalink
Browse files

TempObject#reset! was a bit naive - don't reset non-data related inst…

…ance vars
  • Loading branch information...
1 parent 97d9c64 commit deb47bdd9cf8c8d64628bc12f55d3a5a4ab0c174 Mark Evans committed May 3, 2010
Showing with 6 additions and 4 deletions.
  1. +1 −3 lib/dragonfly/temp_object.rb
  2. +5 −1 spec/dragonfly/temp_object_spec.rb
View
4 lib/dragonfly/temp_object.rb
@@ -143,9 +143,7 @@ def to_io(&block)
private
def reset!
- instance_variables.each do |var|
- instance_variable_set(var, nil)
- end
+ @data = @tempfile = @initialized_data = @initialized_file = @initialized_tempfile = nil
end
def initialize_from_object!(obj)
View
6 spec/dragonfly/temp_object_spec.rb
@@ -229,7 +229,11 @@ def new_temp_object(data, klass=Dragonfly::TempObject)
@temp_object.modify_self!(@temp_object)
@temp_object.data.should == 'DATA_ONE'
end
-
+ it "should keep the same name" do
+ @temp_object.name = 'billy.bob'
+ @temp_object.modify_self!('WASSUP PUNk')
+ @temp_object.name.should == 'billy.bob'
+ end
end
describe "name" do

0 comments on commit deb47bd

Please sign in to comment.