Guest User

Untitled

a guest
Mar 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. def setup
  2. ActiveResource::HttpMock.respond_to do |mock|
  3. mock.get "/users/authenticated.xml?password=secret&username=andres%40joyent.com", {}, user(:authenticated)
  4. mock.get "/organizations/123.xml", {}, organization(:acme)
  5. mock.get "/organizations/123/users.xml", {}, user(:users)
  6. mock.get "/organizations/123/users/1.xml", {}, user(:andres)
  7. mock.get "/organizations/123/users/2.xml", {}, user(:luis)
  8. mock.get "/organizations/123/users/4.xml", {}, nil, 404
  9. mock.put "/users/1.xml", {}, nil, 200
  10. end
  11.  
  12. # Finding users should be User.find(id, :params => {:organization_id => org_id})
  13. # but dont know how to do this since there are two routings for users resource:
  14. # one for authentication and one for users belonging to an organization
  15. @acme = Organization.find(123)
  16. end
Add Comment
Please, Sign In to add comment