I'm looking to send raw post data (e.g. unparamaterized json) to one of my controllers for testing:
class LegacyOrderUpdateControllerTest < ActionController::TestCase
test "sending json" do
post :index, '{"foo":"bar", "bool":true}'
end
end
but this gives me a NoMethodError: undefined method `symbolize_keys' for #<String:0x00000102cb6080>
What is the correct way to send raw post data in ActionController::TestCase?
Here is some controller code
def index
post_data = request.body.read
req = JSON.parse(post_data)