Commit 7a446b9e

mo khan <mo@mokhan.ca>
2014-06-07 04:33:23
update specs to just make sure the upload happens in phot.
1 parent 91c9b71
Changed files (1)
spec
services
application
spec/services/application/handlers/process_photo_spec.rb
@@ -13,14 +13,12 @@ describe ProcessPhoto do
 
   describe "#handle" do
     let(:image_path) { File.join(Rails.root, 'spec/fixtures/images/gps.jpg') }
-    let(:photo) { Photo.new(id: rand(100), image_processing: true) }
-    let(:latitude)  { rand(100) }
-    let(:longitude)  { rand(100) }
+    let(:photo) { double(upload: true, save!: true) }
 
     before :each do
-      photos.stub(:find).with(photo.id).and_return(photo)
+      photos.stub(:find).with(1).and_return(photo)
       message = {
-        photo_id: photo.id,
+        photo_id: 1,
         file_path: image_path,
         content_type: 'image/jpeg',
       }
@@ -28,24 +26,8 @@ describe ProcessPhoto do
     end
 
     it "saves the uploaded image" do
-      photo.image.should_not be_nil
-    end
-
-    it "indicates that the photo has been processed." do
-      photo.image_processing.should be_nil
-    end
-
-    it "specifies the content type" do
-      photo.content_type.should == 'image/jpeg'
-    end
-
-    it "specifies the original filename" do
-      photo.original_filename.should == 'gps.jpg'
-    end
-
-    it "applies the geolocation information" do
-      photo.latitude.should == latitude
-      photo.longitude.should == longitude
+      expect(photo).to have_received(:upload).with(image_path, blob_storage)
+      expect(photo).to have_received(:save!)
     end
   end
 end