Guest User

Untitled

a guest
Oct 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.57 KB | None | 0 0
  1.  
  2.  
  3.   def export
  4.     respond_to do |format|
  5.       format.tdl do
  6.         render :xml => @template.export_as_tdl
  7.         return
  8.       end
  9.      
  10.       format.any do
  11.         render :json => @template.export_as_json
  12.       end
  13.     end
  14.   end
  15.  
  16.  
  17.  
  18.   describe "export" do
  19.     it "should call export_as_json" do
  20.       @tpl.should_receive(:export_as_json)
  21.  
  22.       get :export, :id => TEMPLATE_ID
  23.     end
  24.  
  25.     it "should call export_as_tdl" do
  26.       @tpl.should_receive(:export_as_tdl)
  27.  
  28.       @request.env["HTTP_ACCEPT"] = "application/tdl-xml"
  29.       get :export, :id => TEMPLATE_ID
  30.     end
  31.   end
Add Comment
Please, Sign In to add comment