test/paperclip_test.rb in paperclip-3.0.2 vs test/paperclip_test.rb in paperclip-3.0.3

- old
+ new

@@ -58,17 +58,19 @@ end end context "Paperclip.each_instance_with_attachment" do setup do - @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb') + @file = File.new(fixture_file("5k.png"), 'rb') d1 = Dummy.create(:avatar => @file) d2 = Dummy.create d3 = Dummy.create(:avatar => @file) @expected = [d1, d3] end + teardown { @file.close } + should "yield every instance of a model that has an attachment" do actual = [] Paperclip.each_instance_with_attachment("Dummy", "avatar") do |instance| actual << instance end @@ -127,10 +129,10 @@ end context "An ActiveRecord model with an 'avatar' attachment" do setup do rebuild_model :path => "tmp/:class/omg/:style.:extension" - @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb') + @file = File.new(fixture_file("5k.png"), 'rb') end teardown { @file.close } should "not error when trying to also create a 'blah' attachment" do