Add spec for binary data
This commit is contained in:
		
							parent
							
								
									39355ff0f2
								
							
						
					
					
						commit
						fa6235cd1f
					
				
							
								
								
									
										
											BIN
										
									
								
								spec/fixtures/rockrule.jpeg
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								spec/fixtures/rockrule.jpeg
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 16 KiB  | 
@ -177,7 +177,6 @@ describe "App with Riak backend" do
 | 
				
			|||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it "delivers the data correctly" do
 | 
					        it "delivers the data correctly" do
 | 
				
			||||||
          header "Authorization", "Bearer 123"
 | 
					 | 
				
			||||||
          get "/jimmy/documents/jason"
 | 
					          get "/jimmy/documents/jason"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          last_response.body.must_equal '{"foo":"bar","unhosted":1}'
 | 
					          last_response.body.must_equal '{"foo":"bar","unhosted":1}'
 | 
				
			||||||
@ -185,6 +184,29 @@ describe "App with Riak backend" do
 | 
				
			|||||||
        end
 | 
					        end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      context "with binary data" do
 | 
				
			||||||
 | 
					        before do
 | 
				
			||||||
 | 
					          header "Content-Type", "image/jpeg; charset=binary"
 | 
				
			||||||
 | 
					          filename = File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", "rockrule.jpeg")
 | 
				
			||||||
 | 
					          @image = File.open(filename, "r").read
 | 
				
			||||||
 | 
					          put "/jimmy/documents/jaypeg", @image
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        it "uses the requested content type" do
 | 
				
			||||||
 | 
					          get "/jimmy/documents/jaypeg"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          last_response.status.must_equal 200
 | 
				
			||||||
 | 
					          last_response.content_type.must_equal "image/jpeg; charset=binary"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        it "delivers the data correctly" do
 | 
				
			||||||
 | 
					          get "/jimmy/documents/jaypeg"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          last_response.status.must_equal 200
 | 
				
			||||||
 | 
					          last_response.body.must_equal @image
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      context "with escaped key" do
 | 
					      context "with escaped key" do
 | 
				
			||||||
        before do
 | 
					        before do
 | 
				
			||||||
          put "/jimmy/documents/http%3A%2F%2F5apps.com", "super website"
 | 
					          put "/jimmy/documents/http%3A%2F%2F5apps.com", "super website"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user