Created
January 9, 2015 18:04
-
-
Save timruffles/4f1cca991acfb175ed57 to your computer and use it in GitHub Desktop.
rails - POST JSON in controller tests in rails 3.2.x - can't easily do it, necessary for things as simple as post body containing { action: "something" }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from http://stackoverflow.com/a/13206873/427710 | |
env = Rack::MockRequest.env_for('/posts/1', :method => 'PUT', <some other params>) | |
status, headers, body = PostsController.action(:update).call(env) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment