Guest User

Untitled

a guest
Mar 16th, 2018
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. class ApplicationController < ActionController::Base
  2. include RemoteFixturesLoader
  3. before_filter :setup_mocks
  4. helper :all # include all helpers, all the time
  5.  
  6. # See ActionController::RequestForgeryProtection for details
  7. # Uncomment the :secret if you're not using the cookie session store
  8. protect_from_forgery # :secret => 'a43fadeddd028836dce0919e9576c969'
  9.  
  10. def setup_mocks
  11. remote_fixtures(:accelerators, :cloud_applications, :organizations, :users)
  12. ActiveResource::HttpMock.respond_to do |mock|
  13. mock.get "/users/1.xml", {}, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><user><id type=\"integer\">1</id><name>Andres Rodriguez</name><email>andres@joyent.com</email></user>", 200
  14. mock.get "/users/authenticated.xml?password=secret&username=andres%40joyent.com", {}, user(:authenticated)
  15. mock.get "/organizations/123.xml", {}, organization(:acme)
  16. mock.get "/organizations/123/users.xml", {}, user(:users)
  17. mock.get "/organizations/123/users/1.xml", {}, user(:andres)
  18. mock.get "/organizations/123/users/2.xml", {}, user(:luis)
  19. mock.get "/organizations/123/users/4.xml", {}, nil, 404
  20. mock.put "/users/1.xml", {}, nil, 200
  21. end
  22. end
  23. end
Add Comment
Please, Sign In to add comment