Skip to content

Commit

Permalink
Add Benchmark on test.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Aug 20, 2012
1 parent 2ffae65 commit e045b96
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
.DS_Store
*.gem
uploads/
Binary file modified spec/foo.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions spec/upload_spec.rb
Expand Up @@ -46,11 +46,13 @@ class Photo < ActiveRecord::Base
context "Upload Image" do
it "does upload image" do
f = load_file("foo.jpg")
photo = Photo.create(:image => f)
photo.errors.count.should == 0
open(photo.image.url).should_not == nil
open(photo.image.url).size.should == f.size
open(photo.image.small.url).should_not == nil
puts Benchmark.measure {
@photo = Photo.create(:image => f)
}
@photo.errors.count.should == 0
open(@photo.image.url).should_not == nil
open(@photo.image.url).size.should == f.size
open(@photo.image.small.url).should_not == nil
end
end
end
end

0 comments on commit e045b96

Please sign in to comment.