Browse files

Test photo upload.

  • Loading branch information...
1 parent cbdaccd commit 01cfc83d54632a94d8ca41cfd901426a27c6e865 @denispeplin committed Dec 21, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 spec/controllers/products_controller_spec.rb
  2. BIN spec/fixtures/image.jpg
View
13 spec/controllers/products_controller_spec.rb
@@ -85,6 +85,19 @@ def valid_session
end
end
+ describe "with photo" do
+ before :each do
+ @filename = 'image.jpg'
+ @file = fixture_file_upload("/#{@filename}", 'image/jpg')
+ @attributes = valid_attributes.merge({:photo => @file})
+ end
+
+ it "creates a new Product" do
+ post :create, {product: @attributes}, valid_session
+ Product.last.photo_file_name.should == @filename
+ end
+ end
+
describe "with invalid params" do
it "assigns a newly created but unsaved product as @product" do
# Trigger the behavior that occurs when invalid params are submitted
View
BIN spec/fixtures/image.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 01cfc83

Please sign in to comment.