spec/controllers/js_base_spec.rb in rhoconnect-4.0.0.beta.10 vs spec/controllers/js_base_spec.rb in rhoconnect-4.0.0.beta.12

- old
+ new

@@ -70,20 +70,25 @@ set_doc_state(@c1, :cd => @data) delete '/app/v1/JsSample/2', {}, {Rhoconnect::CLIENT_ID_HEADER => @c1.id} last_response.should be_ok end - it "should register deprecated_route" - - it "should call js model name explicitly" do - js = JsSample.new("JsSample") - res = js.login - res.should == "success" + it "should upload blob in multipart post" do + file1,file2 = 'upload1.txt' + @product1['txtfile-rhoblob'] = file1 + @product1['_id'] = 'tempobj1' + cud = {'create'=>{'1'=>{'name'=>'hello'}}, + :blob_fields => ['txtfile-rhoblob']}.to_json + post "/app/#{Rhoconnect::API_VERSION}/JsSample", + {:cud => cud,'txtfile-rhoblob-1' => + Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__),'..','testdata',file1), "application/octet-stream")}, + {Rhoconnect::CLIENT_ID_HEADER => @c.id} + last_response.should be_ok + get "/app/#{Rhoconnect::API_VERSION}/JsSample", {}, {Rhoconnect::CLIENT_ID_HEADER => @c.id} + json = JSON.parse(last_response.body) + json[5]['links'].should == { "1" => { "l" => "blob_created" } } + json[5]['delete'].should == { "blob_created" => { "name" => "hello", "txtfile-rhoblob" => "blob_created" } } end - it "should print warning if model function not found" do - js = JsSample.new("JsSample") - res = js.foo - res.should == "foo method not defined for JsSample" - end + it "should register deprecated_route" end end \ No newline at end of file