spec/controllers/js_base_spec.rb in rhoconnect-4.0.0.beta.24 vs spec/controllers/js_base_spec.rb in rhoconnect-4.0.0
- old
+ new
@@ -93,8 +93,28 @@
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 push_objects to js controller" do
+ s = Source.load('JsSample', @s_params)
+ data = {'1' => @product1, '2' => @product2, '3' => @product3}
+ post "/app/#{Rhoconnect::API_VERSION}/JsSample/push_objects",
+ {:user_id => @u.id, :objects => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
+ last_response.should be_ok
+ verify_doc_result(s, {:md => data, :md_size=>'3'})
+ end
+
+ it "should push_deletes to js controller" do
+ data = {'1' => @product1, '2' => @product2, '3' => @product3}
+ s = Source.load('JsSample',@s_params)
+ set_doc_state(s, {:md => data, :md_size => '3'})
+ data.delete('2')
+ post "/app/#{Rhoconnect::API_VERSION}/JsSample/push_deletes",
+ {:user_id => @u.id, :objects => ['2']}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
+ last_response.should be_ok
+ verify_doc_result(s, {:md => data, :md_size=>'2'})
+ end
+
it "should register deprecated_route"
end
end
\ No newline at end of file