Permalink
Browse files

Add Benchmark on test.

  • Loading branch information...
1 parent 2ffae65 commit e045b962b09d017a93792566abd4c54f3a8e0bfc @huacnlee huacnlee committed Aug 20, 2012
Showing with 9 additions and 6 deletions.
  1. +1 −0 .gitignore
  2. BIN spec/foo.jpg
  3. +8 −6 spec/upload_spec.rb
View
@@ -1,2 +1,3 @@
.DS_Store
*.gem
+uploads/
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -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.